Ask Your Question
0

Python3 conflicts with 2ython2

asked 2020-07-14 04:25:53 -0500

Alessandro Melino gravatar image

Hello.

I am using the CanUsb package on Ros Noetic. As you know Noetic use Python3 but this package is written in Python2, so is there any way to solve the incompatibility between this versions and run the canusb.py script?

Of course I have installed Python2 on my PC, but it runs canusb with python3.

Thanks in advance.

Best regards. Alessandro

edit retag flag offensive close merge delete

Comments

it runs canusb with python3.

I'm not sure how to reproduce this. What runs canusb with Python3? What command is being run? It is possible to use Python 2 scripts though it's not recommended and the script won't be able to import other Noetic python packages.

sloretz gravatar image sloretz  ( 2020-07-14 11:02:36 -0500 )edit

Is a script called canusb.py and it is executed from the roslaunch file (<node name="canusb" pkg="canusb" type="canusb.py" output="screen">). You can find it in can usb package.

Alessandro Melino gravatar image Alessandro Melino  ( 2020-07-14 11:34:43 -0500 )edit

Oh, I was thinking the package was depending on something that required Python 2. It looks like the Package doesn't have any Python 2 only dependencies, and instead just hasn't been ported to Python 3 yet. Porting that package to Python 3 is the best way forward, and maybe it is the only way forward since it imports genpy in _CAN.pywhich will only be available for Python 3. The issue you opened is a good start https://github.com/spiralray/canusb/i... .

The package package looks pretty small. It may not be much work to port it, and the maintainer may be interested in a contribution that ports it. Here's a guide to porting a package to Python 3 that might be helpful http://wiki.ros.org/UsingPython3/

sloretz gravatar image sloretz  ( 2020-07-14 16:55:15 -0500 )edit

Okay, thank you for the information. I hope that the maintainer does the porting soon. Best regards.

Alessandro Melino gravatar image Alessandro Melino  ( 2020-07-15 03:50:33 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-05-26 04:12:34 -0500

Alessandro Melino gravatar image

Solved creating a script on Python3 from scratch.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2020-07-14 04:25:53 -0500

Seen: 86 times

Last updated: May 26 '21