Python bridge question

Posted By: MaskOfZorro

Python bridge question - 04/03/19 10:11

I'm trying to use the multiprocessing module in Zorro 2.05 but to no success, ending up with AttributeError: module 'sys' has no attribute 'argv' in the error log.

The script is simply of the form

Quote:
import multiprocessing as mp

def f():
...
p = mp.Process(target = f)
p.start()


where f is some function. Regardless of f or whether I set things up through the .py file in pyStart() or use pyX(), I get the same error.

Googling a bit on this error led me to https://docs.python.org/2.0/api/embedding.html (admittedly for Python 2.0)

Quote:
Py_Initialize() does not set the ``script argument list'' (sys.argv). If this variable is needed by Python code that will be executed later, it must be set explicitly with a call to PySys_SetArgv(argc, argv) subsequent to the call to Py_Initialize().


So I'm wondering if, apart from any possible error on my side, what I'm trying to do is currently just futile.

Posted By: jcl

Re: Python bridge question - 04/03/19 11:36

It is indeed not set since the Zorro argv would make no sense for Python, but can't you directly set sys.argv in your Python script? That should do the same.
© 2024 lite-C Forums