Python 3 minor irritation

Alf P. Steinbach alfps at start.no
Thu Feb 4 03:56:53 CET 2010


* David Monaghan:
> I have a small program which reads files from the directory in which it
> resides. It's written in Python 3 and when run through IDLE or PythonWin
> works fine. If I double-click the file, it works fine in Python 2.6, but in
> 3 it fails because it looks for the files to load in the Python31 folder,
> not the one the script is in.
> 
> It's not a big deal, but browsing around I haven't found why the behaviour
> has been changed or any comment about it (That might be my poor search
> technique, I suppose).
> 
> The program fails at:
> 
>     try:
>         tutdoc = minidom.parse(".//Myfile.xml")
>     except IOError:
>         <snip>

The "//" is wrong, but should not cause the behavior that you describe.

Try to post a complete smallest possible program that exhibits the problem.

Possibly, in creating that example you'll also find what's cause the problem. :-)


Cheers & hth.,

- Alf



More information about the Python-list mailing list