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

ryniek ryniek90 at gmail.com
Mon Aug 24 17:23:41 EDT 2009


On 24 Sie, 22:34, ryniek <rynie... at gmail.com> wrote:
> On 24 Sie, 16:56, John Machin <sjmac... at lexicon.net> wrote:
>
> > On Aug 25, 12:46 am, Tim Golden <m... at timgolden.me.uk> wrote:
>
> > > 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
>
> > That is the most inappropriate "of course" I've seen for quite a
> > while.
>
> > > the Alternate Data Streams:
>
> > OK, so s/illegal/evil/
>
> Ok, but how to get rid of those colons?
> Is it necessary?

I dealt with it. Had to change 'w:bz2' into 'w|bz2'.

But now have another problem:
"
C:\Users\Ryniek's WinSe7en\Documents\My Dropbox\Aplikacje
\Moje_aplikacje\Pythonowe_aplikacje\Skrypty>python ba
ckuper.py -f E:\APLIKACJE\nowegg.exe E:\ MyGG
Checking permissions for reading and writing...
Traceback (most recent call last):
  File "backuper.py", line 194, in <module>
    main_meth()
  File "backuper.py", line 186, in main_meth
    paq.backup_file(pars.options.filename[0], pars.options.filename
[1], pars.options.filename[2])
  File "backuper.py", line 114, in backup_file
    backup_obj = tarfile.open(dest, 'w|bz2')
  File "E:\WinSe7en Apps\APLIKACJE\ActiveState Python 2.6\lib
\tarfile.py", line 1675, in open
    _Stream(name, filemode, comptype, fileobj, bufsize),
  File "E:\WinSe7en Apps\APLIKACJE\ActiveState Python 2.6\lib
\tarfile.py", line 400, in __init__
    fileobj = _LowLevelFile(name, mode)
  File "E:\WinSe7en Apps\APLIKACJE\ActiveState Python 2.6\lib
\tarfile.py", line 373, in __init__
    self.fd = os.open(name, mode)
OSError: [Errno 22] Invalid argument: 'E:\\MyGG(2009-08-24
23:18:25).tar.bz2'
"

When i type path with foreward slashes, Python converts them to double
backslashes  :P
"
C:\Users\Ryniek's WinSe7en\Documents\My Dropbox\Aplikacje
\Moje_aplikacje\Pythonowe_aplikacje\Skrypty>python backuper.py -f E:/
APLIKACJE/nowegg.exe E:/ MyGG
Checking permissions for reading and writing...
Traceback (most recent call last):
  File "backuper.py", line 194, in <module>
    main_meth()
  File "backuper.py", line 186, in main_meth
    paq.backup_file(pars.options.filename[0], pars.options.filename
[1], pars.options.filename[2])
  File "backuper.py", line 114, in backup_file
    backup_obj = tarfile.open(dest, 'w|bz2')
  File "E:\WinSe7en Apps\APLIKACJE\ActiveState Python 2.6\lib
\tarfile.py", line 1675, in open
    _Stream(name, filemode, comptype, fileobj, bufsize),
  File "E:\WinSe7en Apps\APLIKACJE\ActiveState Python 2.6\lib
\tarfile.py", line 400, in __init__
    fileobj = _LowLevelFile(name, mode)
  File "E:\WinSe7en Apps\APLIKACJE\ActiveState Python 2.6\lib
\tarfile.py", line 373, in __init__
    self.fd = os.open(name, mode)
OSError: [Errno 22] Invalid argument: 'E:\\MyGG(2009-08-24
23:20:19).tar.bz2'
"

I tried raw string also, but nothing helps.   :-/



More information about the Python-list mailing list