Python horks on WinXP path names

Ian Kelly ian.g.kelly at gmail.com
Thu Dec 8 15:43:05 EST 2011


On Thu, Dec 8, 2011 at 1:16 PM, Eric <einazaki668 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



More information about the Python-list mailing list