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

Stephen Hansen apt.shansen at
Mon Aug 24 17:03:56 CEST 2009

> 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?

Colons are not valid in filenames on Windows. You won't get that filename to
work. The error may be somewhat cryptic. Depending on the version of Windows
and the particulars of your filesystem, *attempting* to read/write a
filename with a colon may lead to very surprising results-- 0 sized files
with names up to the colon... as you may actually be writing to an alternate
named data stream (like a resource fork on the mac).

Basically, the error is just cryptic. The problem is your filename isn't a
valid windows filename :)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list