Re: Temat:, Re: IOError: [Errno 22] invalid mode ('wb') or filename: in windows xp while making tarfile
On 25 Sie, 07:33, Dennis Lee Bieber wlfr...@ix.netcom.com wrote: On Mon, 24 Aug 2009 14:23:41 -0700 (PDT), ryniek rynie...@gmail.com declaimed the following in gmane.comp.python.general: C:\Users\Ryniek's WinSe7en\Documents\My Dropbox\Aplikacje \Moje_aplikacje\Pythonowe_aplikacje\Skryptypython ba ckuper.py -f E:\APLIKACJE\nowegg.exe E:\ MyGG snip OSError: [Errno 22] Invalid argument: 'E:\\MyGG(2009-08-24 23:18:25).tar.bz2' WHERE in your program are you creating that file name? Based upon the invocation line, all you are supplying is the E:\MyGG part... Somewhere you are creating a timestamp and attaching that to the prefix. THAT is where you need to get rid of the colons -- the ones in the timestamp. Instead of 23:18:25 (or whatever the next run generates) you want something like 23_18_25... -- Wulfraed Dennis Lee Bieber KD6MOG wlfr...@ix.netcom.com HTTP://wlfraed.home.netcom.com/ Yep, i realized that it were THOSE colons. Thanks very much. I think i must work on my perceptivity : P Thanks again. -- http://mail.python.org/mailman/listinfo/python-list
Temat:,Re: IOError: [Errno 22] invalid mode ('wb') or filename: in windows xp while making tarfile
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 ). -- http://mail.python.org/mailman/listinfo/python-list
IOError: [Errno 22] invalid mode ('wb') or filename: in windows xp while making tarfile
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/c42aca3eb53... http://groups.google.com/group/sympy/browse_thread/thread/c42aca3eb532928c ). -- http://mail.python.org/mailman/listinfo/python-list
Re: Temat:,Re: IOError: [Errno 22] invalid mode ('wb') or filename: in windows xp while making tarfile
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 -- http://mail.python.org/mailman/listinfo/python-list
Re: Temat:,Re: IOError: [Errno 22] invalid mode ('wb') or filename: in windows xp while making tarfile
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 -- http://mail.python.org/mailman/listinfo/python-list
Re: Temat:, Re: IOError: [Errno 22] invalid mode ('wb') or filename: in windows xp while making tarfile
On Aug 25, 12:46 am, Tim Golden m...@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/ -- http://mail.python.org/mailman/listinfo/python-list
Re: IOError: [Errno 22] invalid mode ('wb') or filename: in windows xp while making tarfile
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 :) --S -- http://mail.python.org/mailman/listinfo/python-list
Re: Temat:, Re: IOError: [Errno 22] invalid mode ('wb') or filename: in windows xp while making tarfile
On 24 Sie, 16:56, John Machin sjmac...@lexicon.net wrote: On Aug 25, 12:46 am, Tim Golden m...@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? -- http://mail.python.org/mailman/listinfo/python-list
Re: Temat:, Re: IOError: [Errno 22] invalid mode ('wb') or filename: in windows xp while making tarfile
On 24 Sie, 22:34, ryniek rynie...@gmail.com wrote: On 24 Sie, 16:56, John Machin sjmac...@lexicon.net wrote: On Aug 25, 12:46 am, Tim Golden m...@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\Skryptypython 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\Skryptypython 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. :-/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Temat:, Re: IOError: [Errno 22] invalid mode ('wb') or filename: in windows xp while making tarfile
You shouldn't want either a colon or a pipe symbol in the filename string (not counting the drive letter prefix). A single colon gives you surprising behavior, and two will give you Invalid Argument. See inline responses. ryniek wrote: On 24 Sie, 22:34, ryniek rynie...@gmail.com wrote: snip Ok, but how to get rid of those colons? Is it necessary? I dealt with it. Had to change 'w:bz2' into 'w|bz2'. Looks to me like you're putting a pipe in again (unless that's just an artifact of the mail system) But now have another problem: C:\Users\Ryniek's WinSe7en\Documents\My Dropbox\Aplikacje \Moje_aplikacje\Pythonowe_aplikacje\Skryptypython 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 =arfile.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 =s.open(name, mode) OSError: [Errno 22] Invalid argument: 'E:\\MyGG(2009-08-24 23:18:25).tar.bz2' Still have two erroneous colons in that string. The one after the E is okay. 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\Skryptypython 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 =arfile.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 =s.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. :-/ If a string has a backslash in it, and it is printed, you see a single backslash. But if it is output with repr(), then you see it doubled, just as you would do if you were typing it in as a literal. That does NOT mean that it has a double backslash, it just means that particular display formatting shows you that. Try the following to see what I mean: st = re:\testing\again.txt st 'e:\\testing\\again.txt' print st e:\testing\again.txt print [st, st] ['e:\\testing\\again.txt', 'e:\\testing\\again.txt'] Since you don't know how a particular error message was constructed, you don't know for sure which way to interpret the results. That comes with practice. In the meantime, if you print a simple string with simple print, you should be able to see it fine. Incidentally, in nearly every case, Windows ignores extra backslashes. So that's not likely to be your problem. Get rid of those colons, without replacing them with pipes. DaveA -- http://mail.python.org/mailman/listinfo/python-list
Re: Temat:,Re: IOError: [Errno 22] invalid mode ('wb') or filename: in windows xp while making tarfile
ryniek wrote: On 24 Sie, 22:34, ryniek rynie...@gmail.com wrote: On 24 Sie, 16:56, John Machin sjmac...@lexicon.net wrote: On Aug 25, 12:46 am, Tim Golden m...@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: It's the same problem, asked and answered. Why not read the replies of the people telling you what the problem is? -- Erik Max Francis m...@alcyone.com http://www.alcyone.com/max/ San Jose, CA, USA 37 18 N 121 57 W AIM/Y!M/Skype erikmaxfrancis If the sky should fall, hold up your hands. -- (a Spanish proverb) -- http://mail.python.org/mailman/listinfo/python-list
Re: IOError: [Errno 22] invalid mode ('wb') or filename: in windows xp while making tarfile
Ryniek90 rynie...@gmail.com 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, t...@probo.com Providenza Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list
IOError: [Errno 22] invalid mode ('wb') or filename: in windows xp while making tarfile
Hi I've got my backup script which opens tarfile for add chosen file to it. But while setting it up, i've got Traceback: here's the url: --http://paste.ubuntu.com/258081/-- I have searched among google's result but didn't found anything useful. Only found info that it may be the backslashes fault in path, but i have written proper the path. Here's link to my script paste: http://paste.ubuntu.com/258087/ Is its the '|\U' literal fault in path '|C:\\Users\\Ryniek's WinSe7en\\MyNewGGBackup(2009-08-23 14:59:02).tar.bz2|' ? Sorry if i'm annoying but i'm still learning. | -- http://mail.python.org/mailman/listinfo/python-list
Re: IOError: [Errno 22] invalid mode ('wb') or filename: in windows xp while making tarfile
Ryniek90 wrote: I've got my backup script which opens tarfile for add chosen file to it. But while setting it up, i've got Traceback: here's the url: --http://paste.ubuntu.com/258081/-- I have searched among google's result but didn't found anything useful. Only found info that it may be the backslashes fault in path, but i have written proper the path. Here's link to my script paste: http://paste.ubuntu.com/258087/ Is its the '|\U' literal fault in path '|C:\\Users\\Ryniek's WinSe7en\\MyNewGGBackup(2009-08-23 14:59:02).tar.bz2|' ? Sorry if i'm annoying but i'm still learning. It's probably a misleading error from the OS; I would guess the problem is that the filename contains colons, which I believe is a no-no on Windows. You want to make sure to always escape your backslashes (or use raw strings), too, or that's going to bite you sometime later (but it's not your main problem here). -- Erik Max Francis m...@alcyone.com http://www.alcyone.com/max/ San Jose, CA, USA 37 18 N 121 57 W AIM/Y!M/Skype erikmaxfrancis Every human being is a problem in search of a solution. -- Ashley Montague -- http://mail.python.org/mailman/listinfo/python-list
Re: IOError: [Errno 22] invalid mode ('wb') or filename: in windows xp while making tarfile
Erik Max Francis max at alcyone.com writes: Ryniek90 wrote: Is its the '|\U' literal fault in path '|C:\\Users\\Ryniek's WinSe7en\\MyNewGGBackup(2009-08-23 14:59:02).tar.bz2|' ? What is the '|\U' literal fault ??? It's probably a misleading error from the OS; I would guess the problem is that the filename contains colons, which I believe is a no-no on Windows. The colons are the problem. The error message is not from the OS; it is concocted by Python (see fileobject.c) as what appears to be the best possible text given vague error reporting by Windows. I don't understand probably a misleading error [message] -- invalid mode (actual value) or filename - invalid something-obviously-not-invalid or filename - invalid filename -- http://mail.python.org/mailman/listinfo/python-list
Re: IOError: [Errno 22] invalid mode ('wb') or filename: in windows xp while making tarfile
John Machin wrote: Erik Max Francis max at alcyone.com writes: Ryniek90 wrote: Is its the '|\U' literal fault in path '|C:\\Users\\Ryniek's WinSe7en\\MyNewGGBackup(2009-08-23 14:59:02).tar.bz2|' ? What is the '|\U' literal fault ??? It's probably a misleading error from the OS; I would guess the problem is that the filename contains colons, which I believe is a no-no on Windows. The colons are the problem. The error message is not from the OS; it is concocted by Python (see fileobject.c) as what appears to be the best possible text given vague error reporting by Windows. I don't understand probably a misleading error [message] -- invalid mode (actual value) or filename - invalid something-obviously-not-invalid or filename - invalid filename 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. DaveA -- http://mail.python.org/mailman/listinfo/python-list
Re: IOError: [Errno 22] invalid mode ('wb') or filename: in windows xp while making tarfile
Dave Angel davea at ieee.org writes: 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|' -- http://mail.python.org/mailman/listinfo/python-list