Python Forum
python update binary object (override delivered Object properties)
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
python update binary object (override delivered Object properties)
#1
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:
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
Reply


Messages In This Thread
python update binary object (override delivered Object properties) - by pierre38 - May-17-2022, 03:30 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Return a string or byte object from Enum class? Calab 5 747 May-14-2025, 05:21 PM
Last Post: snippsat
  How to understand object-oriented programming? snl_9527 3 640 May-02-2025, 03:21 PM
Last Post: noisefloor
  Merge htm files with shutil library (TypeError: 'module' object is not callable) Melcu54 7 3,683 Mar-09-2025, 04:25 PM
Last Post: Pedroski55
  type object 'man' has no attribute 'centerX' Tempo 7 1,120 Mar-07-2025, 03:47 AM
Last Post: deanhystad
  float object can't be interpreted as an integer t23 2 1,134 Jan-18-2025, 07:36 PM
Last Post: deanhystad
  Storing DictProxy object and modifying its nested value? haihal 3 1,394 Dec-20-2024, 04:58 AM
Last Post: deanhystad
  Extract args=, value that was passed to Multiprocessing.Proc object during runtime? haihal 1 728 Dec-08-2024, 07:04 AM
Last Post: Gribouillis
  what is solution to save and reload a object? eue 4 2,690 Nov-23-2024, 02:15 PM
Last Post: DeaD_EyE
  Trying to get JSON object in python and process it further Creepy 2 1,155 Oct-24-2024, 08:46 AM
Last Post: buran
  How to move an object over time rather than instantly? temlotresid6 3 2,034 Oct-23-2024, 11:20 AM
Last Post: temlotresid6

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020