Python Forum
How to modify __init__ of built-in module directly from the script?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to modify __init__ of built-in module directly from the script?
#6
For sure it was not my original intention to mess with third-party package source, but what else can you do if you miss functionality?
It was exactly my original question, how do I do this directly in my own script, so that I don't need to touch the original code.
And because the inheritance in this case is a bit complicated (at least to me), I wasn't sure how to achieve it.

Your last post answered my question.
The line:

mgmt.tm.asm._meta_data['allowed_lazy_attributes'].append(Violations_s)
did the trick!

I have just tested it and it works perfectly.

Those new classes I simply declared directly in my script, so even there is no need for the import statement.
This way I can keep all the code in just one file, while I don't touch the original source code.

Thanks a lot for the tip and help ;-)
Reply


Messages In This Thread
RE: How to modify __init__ of built-in module directly from the script? - by sonicblind - Jul-31-2018, 12:48 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Import XML file directly into Excel spreadsheet demdej 0 887 Jan-24-2023, 02:48 PM
Last Post: demdej
  How to modify python script to append data on file using sql server 2019? ahmedbarbary 1 1,254 Aug-03-2022, 06:03 AM
Last Post: Pedroski55
  Make console show after script was built with Pyinstaller --NOCONSOLE? H84Gabor 0 1,240 May-05-2022, 12:32 PM
Last Post: H84Gabor
  No module named '_cffi_backend' error with executable not with python script stephanh 2 5,760 Nov-25-2021, 06:52 AM
Last Post: stephanh
  using WinRt module in python script akhilgnair 0 2,133 Apr-23-2021, 05:38 AM
Last Post: akhilgnair
  How to load log.txt directly into python codes? sparkt 6 3,028 Aug-21-2020, 03:51 PM
Last Post: sparkt
  Get input directly as a number? Pedroski55 4 2,239 May-05-2020, 04:29 PM
Last Post: deanhystad
  TypeError indexing a range of elements directly on the list JFerreira 2 2,254 Mar-30-2020, 04:22 PM
Last Post: bowlofred
  modify script. MuhammadTalha 15 4,742 Nov-23-2019, 04:43 PM
Last Post: Gribouillis
  Is there any way to convert a python script (with Tkinter module), to a .exe (Windows moste 3 4,056 May-12-2019, 12:02 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

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