Reputation: 4485
I have written a program in Python 3 that relies on another program in Python 2.7 for some core tasks. It works seamlessly on gnunux since most distribution have already 2.7 installed, I just have to require Python 3, and it's all good.
But now I want to port the bundle to Windows, and I don't know how to manage this. I have the following issues
subprocess.call(... shell=True)
and relies on Python scripts' shebangs to use the right version. As far as I know, there is no way to emulate such behaviour on Windows.I have the source code for everything I use, and everything is under libre licenses, so I don't have issues with compiling to PE or porting 2.7 scripts to 3, but it would be a tedious work. The only solution I have found so far is to port everything to Python 3. Can you think of another one?
Upvotes: 1
Views: 208
Reputation: 28686
So I guess you're left with either requiring installation of python 2.7 and python 3 on the target system, or making separate exe's for your 2.7 and 3 scripts, and changing your subprocess calls to call these instead. (you could bundle the python installations with your own instead of using standard system-wide python installs, but you'd still have to change your subprocess calls instead of relying on windows default application for file extensions)
Upvotes: 1
Reputation: 498
How about using PyInstaller? Never used it myself but:
PyInstaller is a program that converts (packages) Python programs into stand-alone executables, under Windows, Linux, and Mac OS X.
So you could convert both your programs to executables and then call one from inside the other.
Upvotes: 1