Python3 conflicts with 2ython2
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
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.
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.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.py
which 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/
Okay, thank you for the information. I hope that the maintainer does the porting soon. Best regards.