Python horks on WinXP path names

Eric einazaki668 at yahoo.com
Thu Dec 8 15:56:38 EST 2011


On Dec 8, 2:43 pm, Ian Kelly <ian.g.ke... at gmail.com> wrote:
> On Thu, Dec 8, 2011 at 1:16 PM, Eric <einazaki... at yahoo.com> wrote:
> > I'm running Python 2.7 on WinXP (ActiveState community version) and
> > when I try to do this:
>
> > if __name__ == '__main__':
> >    root = Tkinter.Tk()
> >    root.withdraw()
> >    fileNames = tkFileDialog.askopenfilenames()
> >    root.destroy()
> >    print fileNames
> > # windows filename gets
> > for fileName in fileNames:
> >    print fileName
> >    file = open(fileName, 'r')
> >    for line in file.readlines():
> >            print line.strip()
>
> > I get this:
>
> > C:\Documents and Settings\eric\Desktop\PythonShop>python picker.py
> > {C:/Documents and Settings/eric/Desktop/PythonShop/cereal.py}
> > {
> > Traceback (most recent call last):
> >  File "picker.py", line 31, in <module>
> >    file = open(fileName, 'r')
> > IOError: [Errno 2] No such file or directory: u'{'
>
> > That is, fileName is in a form that open() doesn't recognize.  On a
> > BSD box the code works fine.  What's going on with the file name and
> > how do I fix it?
>
> http://bugs.python.org/issue5712


Thanks!

eric



More information about the Python-list mailing list