May-17-2022, 03:30 PM
Hello,
I did many trials without success. I need to have flexibility in my Python code, so I use already .yaml configuration for deliverable scripts (generated executable from pyInstaller), but this is not enough.
I am trying to find out if it is possible to redefine some methods from a python wrapper script calling the executable binary script.
Below is the example:
wrap.py:
> python wrap.py
Traceback (most recent call last):
File "wrap.py", line 7, in <module>
Foo.displayParam = displayParam
NameError: name 'Foo' is not defined
Can someone provide me some advice ?
thanks a lot,
Pierre
I did many trials without success. I need to have flexibility in my Python code, so I use already .yaml configuration for deliverable scripts (generated executable from pyInstaller), but this is not enough.
I am trying to find out if it is possible to redefine some methods from a python wrapper script calling the executable binary script.
Below is the example:
wrap.py:
import os # import invest or ?? def displayParam(self): print("overriden text") Foo.displayParam = displayParam os.system("/prj/mms_nvm/cad_prj/python/users/paolipie/python/py_workdev/create_deliverable/dist/invest/invest")invest.py
import sys from src.foo import Foo def main(argv): foo = Foo() foo.displayParam() # exec if __name__ == "__main__": main(sys.argv[1:])foo.py
import sys import os from pathlib import Path # main class Foo: def __init__(self): self.other = None def displayParam(self): print("default text")When I execute the wrap.py:
> python wrap.py
Traceback (most recent call last):
File "wrap.py", line 7, in <module>
Foo.displayParam = displayParam
NameError: name 'Foo' is not defined
Can someone provide me some advice ?
thanks a lot,
Pierre