IOError: [Errno 22] invalid mode ('wb') or filename: in windows xp while making tarfile

Ryniek90 ryniek90 at gmail.com
Mon Aug 24 16:04:07 CEST 2009


 >> John Machin wrote:

 >>> Erik Max Francis <max <at> alcyone.com> writes:

 >> I also suspect the "pipe" symbol. I don't know if it's an invalid
 >> character to Windows, but it's certainly a bad idea.  The '|' character
 >> means something special to the shell.

 > The "pipe" character is not a valid character in a Windows file.
 > Despite the OP's message wrapping the filename in "pipes",
 > there are no pipes in the filename in the traceback to
 > which he posted a link.  Wrapping the filename in "pipes"
 > and the cryptic reference to "the '|\U' literal fault"
 > appear to be side-issue bogglements.

 >  >>> open('boggle|txt', 'wb')
 >  Traceback (most recent call last):
 >    File "<stdin>", line 1, in <module>
 >  IOError: [Errno 22] invalid mode ('wb') or filename: 'boggle|txt'
 >  >>> open('|boggle.txt|', 'wb')
 >  Traceback (most recent call last):
 >    File "<stdin>", line 1, in <module>
 >  IOError: [Errno 22] invalid mode ('wb') or filename: '|boggle.txt|'

Sorry, but i don't know where those pipes came from  : P

The proper path is "C:\\Users\\Ryniek's
WinSe7en\\MyNewGGBackup(2009-08-23 14:59:02).tar.bz2"
and that string literal is "\U", without any pipes  :)

The truth is that script works on linux (ubuntu) but not on windows
(neither Win7 nor WinXP).
Maybe it's good idea to use raw string for specifing those paths?

As i mentioned later, some python users had the same problem with this
IOError ( like here: http://www.daniweb.com/forums/thread174552.html  or
here:
http://groups.google.com/group/sympy/browse_thread/thread/c42aca3eb53... 
<http://groups.google.com/group/sympy/browse_thread/thread/c42aca3eb532928c> 

).




More information about the Python-list mailing list