Is it possible to have an application using python 2 and python 3 modules?

I am currently building an app in my raspberry pi. This application must use the I2C bus along the serial port. Previously, I developed both applications independently of each other; for I2C application, I used python3 module to handle bus. But to handle the serial port, I am using python 2 module.

Now I want to create an application that handles two interfaces. Is it possible? How should I do it?

Thank.

+3
python python-3.x compatibility python-2.x raspberry-pi


source to share


2 answers


Finally, I used 2to3 to convert python 2 modules. But due to the module communicating with the serial port (pyserial), the byte processing was not completely converted correctly, so I need to edit the code after conversion using the encoding / decoding functions.



0


source to share


Looking for backports or trying to split it into different processes.



0


source to share







All Articles
Loading...
X
Show
Funny
Dev
Pics