I'm using Python 3.1.4 that is embedded as a scripting environment in an application(x64). So far I have encountered a lot of limitations with the embedded python. I don't know if it is normal or if the programmers of the application have blocked some functionalities.
For example the following code isn't working:
from multiprocessing import Process
def f(name):
print('hello', name)
if __name__ == '__main__':
p = Process(target=f, args=('bob',))
p.start()
p.join()
# --> error in forking.py: 'module' object has no attribute 'argv'
# print(sys.argv) gives the same error
sys.executable return the path to the application.
I've tried this as wel:
multiprocessing.forking.set_executable('C:\Python31\python.exe')
multiprocessing.set_executable('C:\Python31\python.exe')
Without success.
Is there a workaround possible ? It is very unlikely that I would have the leverage to make the developers of the application change something in their code.
Thanks
EDIT
I got it to work by adding the following:
sys.argv = ['c:/pathToScript/scipt.py']
I needed this line as well:
multiprocessing.set_executable('C:/Python31/python.exe')
Otherwise an other instance of the application open instead of running the code.
The only problem I have left is that I can't use the methods that control the application itself (like: create_project(), add_report(),..). My primary goal was to be able to call multiple methods without the need to wait for the first one to finish completion. But I think this is just not possible.