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

Dave Angel davea at dejaviewphoto.com
Mon Aug 24 16:36:42 CEST 2009


Ryniek90 wrote:
> <div class="moz-text-flowed" style="font-family: -moz-fixed">
>>> 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/c42aca3eb532928c 
> ).
>
>
>
> </div>
>
You still haven't gotten rid of those illegal colons in the filename.  
They're not legal in Windows, as has been pointed out a couple of times 
in this thread.

DaveA



More information about the Python-list mailing list