Reputation: 5282
I have a python script: main.py, which executes a cx_frozen python script: test.exe I have created. main.py needs to send variables to test.exe. If the frozen script is able to send variables back that would be great too.
I have, up to this point been saving out .txt files from main.py and accepting them from test.exe side. But now that I am introducing multithreading, I am concerned the instances of test.exe will collect information from the .txts intended for other instances of test.exe.
I was wondering if this is possible? How do I tell main.py to send variables to test.exe accept them ... and, if possible, send them back to main.py
Thanks
Upvotes: 0
Views: 338
Reputation: 5683
The easiest way to send variables to a sub-program is using command line arguments or environment variables. If you want bidirectional communication you can use pipes to transmit the info that you are currently sending over the text files (even on Windows). The python subprocess
(http://docs.python.org/library/subprocess.html) module is very good at that that sort of thing.
Upvotes: 1