Python horks on WinXP path names

E

Eric

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?


TIA,
eric
 
I

Ian Kelly

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
 
E

Eric

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,709
Latest member
AustinMudi

Latest Threads

Top