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

Tim Roberts timr at
Tue Aug 25 06:02:05 CEST 2009

Ryniek90 <ryniek90 at> wrote:
>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).

Right, and it' not going to work as long as you have a colon (:) in the
file name.  Colons are not valid in a Windows file name.  Colons are used
to separate the drive letter and the "stream" name.  It's just that simple.

>Maybe it's good idea to use raw string for specifing those paths?

Doesn't matter.  Get rid of the colons, and your file name will work.
Tim Roberts, timr at
Providenza & Boekelheide, Inc.

More information about the Python-list mailing list