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.

3
  • 1
    Here's a question about running Python 2 from Python 3: stackoverflow.com/questions/27863832/…. I think the same principles can be applied here too Commented May 1, 2020 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. Commented May 1, 2020 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. Commented May 1, 2020 at 16:04

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.