Modifying the global modules included with the distribution

Fredrik Lundh fredrik at pythonware.com
Mon Feb 7 18:34:13 EST 2005


Justin Standard wrote:

> I'm trying to make some small modifications to the xml.dom.minidom
> module.  I'm developing on windows (since I have to at work), and I
> located the .py files which represent the module in the Python23/Lib
> directory, I made my changes to the file:
> Python/Lib/xml/dom/minidom.py.  However, when I run the interpreter,
> my changes aren't reflected.

Python23/Lib or Python/Lib ?

are you sure you know what you're editing?  if you're not 100% sure,
import the module, and print its __file__ attribute:

    >>> import xml.dom.minidom
    >>> xml.dom.minidom.__file__
    '/somewhere/python24/lib/xml/dom/minidom.pyc'

edit the corresponding PY file.  if the PYC path looks suspicious, remove
the PYC file and try again.

> Do I need to rebuild python to make these changes take?

no.

> Or is there some other process to modify global modules.  I realize that
> I _could_ have extended it, but this _seemed_ easier, and the work is already
> done.

and will be lost when you update Python, move your script to another
platform, etc.

</F> 






More information about the Python-list mailing list