2

My main app is running with Python3

I have a crucial package that I need to install which only support Python2...

I'm running on windows

I thought of maybe setting this package on another virtual environment in addition to a flask server to be used for communication.

Is there another way to pipe messages between apps beside a server?

Is there a better way to go for Python2, Python3 mix?

1
  • maybe ask about the packages you're using... there might be alternatives to the package or maybe alternatives to the packages that are forcing you to use python 3 Commented Jun 17, 2018 at 7:56

3 Answers 3

6

How about using the subprocess module. You can start the Python 2 program as a subprocess of your Python 3 app. They can communicate via the subprocess PIPE.

Sign up to request clarification or add additional context in comments.

Comments

1

Flask is too heavy. Why not use socket and selectors? offical example

4 Comments

is your answer to this question?
In my opinion, just building a socket for send&receive message is convenient and light way which communicate between Python2 and Python3.
was just confused why you implied OP uses flask
oh, I see in the middle now
0

Unfortunately, I got the similar problem lately and would like to share my solution. I used multiprocssing.connection module. The default pickling protocol should be changed when sending the data from Python 3 to Python 2. The way to change the default pickling protocol is described in this answer.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.