0

I have a Python 2 script from which I want to call a Python 3 script. I would like to pass an argument to this call and get data back from the Python3 script so I can handle that data in the Python 2 script. What is the best way to realize this?

OS ist Linux and booth versions of Python are installed.

w4tchd0g
  • 51
  • 5
  • 1
    Here's a question about running Python 2 from Python 3: https://stackoverflow.com/questions/27863832/calling-python-2-script-from-python-3. I think the same principles can be applied here too – ForceBru May 01 '20 at 15:59
  • 1
    Which ways did you read about and what exactly prevented you to pick one from them? The default answer is: switch to *Python 3*. – CristiFati May 01 '20 at 16:00
  • The main problem is, that I'm using ROS which supports Python 2 by default. I want to read data from a sensor but the driver of this sensor is written in Python 3. Now I want to call that driver and pass the data to the Python 2 script which is executed by ROS. A switch to Python 3 is not possible at the moment. – w4tchd0g May 01 '20 at 16:04

0 Answers0