execfile() - change python version?

Peter Hansen peter at engcorp.com
Fri Mar 29 23:29:18 EST 2002


Trung Hoang wrote:
> 
> running the following set of commands in a script:
>     import xml.dom.minidom
>     dom = xml.dom.minidom.parseString(somexmlstr)
> 
> using the above in python2.1 from my account: WORKS
> using the above in python2.1 from the web: WORKS
> using the above in python2.2 from my account : WORKS
> using the above in python2.2 from the web : FAILS!
> 
> so im forced to used 2.1 because of xml libraries
> #!/local/usr/bin/python
> as aposed to
> #!/local/usr/bin/python2.2
> 
> it probably does not work because of some environmental
> variable not being set, which when run from the web
> fails to find the SAX parser..

So run Python 2.2 from your account, import xml, 
find out where the file is coming from (xml.__file__), 
and in the script add in something like:

import sys
sys.path.append(the-path-to-where-the-xml-module-is)

-Peter



More information about the Python-list mailing list