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
Originally posted by Alessandro Melino on ROS Answers with karma: 113 on 2020-07-14
Post score: 0
Original comments
Comment by sloretz on 2020-07-14:\
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.
Comment by Alessandro Melino on 2020-07-14:
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.
Comment by sloretz on 2020-07-14:
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/issues/2 .
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/
Comment by Alessandro Melino on 2020-07-15:
Okay, thank you for the information. I hope that the maintainer does the porting soon.
Best regards.