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

Tim Golden mail at timgolden.me.uk
Mon Aug 24 10:46:46 EDT 2009


Dave Angel wrote:
> 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.


Ummm.. Colons are of course legal in Windows filenames as designating
the Alternate Data Streams:

<code>
with open ("c:/temp/test.txt", "w") as f:
  f.write ("base text")

with open ("c:/temp/test.txt:blah", "w") as f:
  f.write ("ADS text")

print open ("c:/temp/test.txt:blah").read ()

</code>

On the other hand, though, you can't have more than one
of them:

<code>
with open ("c:/temp/test.txt:blah:blah2", "w") as f:
  f.write ("ADS text2")

</code>

should raise an error.

TJG



More information about the Python-list mailing list