By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,711 Members | 2,144 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,711 IT Pros & Developers. It's quick & easy.

rdff-backup / python linux fat32

P: n/a
rdiff-backup is aperently written in Python and when I run it in a
special way I get some funy Python errors. Does anyone know if linux
python have some issues with working with fat32 or usb drives? To
tracebacks are provided below for more information.

This is the version information I get when I start Python ojn my Fedora
Core 2 computer.

-bash-2.05b$ python
Python 2.3.3 (#1, May 7 2004, 10:31:40)
[GCC 3.3.3 20040412 (Red Hat Linux 3.3.3-7)] on linux2

The question, I think is is it worth the effort to try an upgrade of
Python to 2.3.4 or a nightly build or something to get around the
problem or is it some more general related to rdiff.

When I run the program normally I get this traceback,

-bash-2.05b$ rdiff-backup MyPhotos /mnt/usbdrive/test8
Traceback (most recent call last):
File "/usr/bin/rdiff-backup", line 23, in ?
rdiff_backup.Main.Main(sys.argv[1:])
File "/usr/lib/python2.3/site-packages/rdiff_backup/Main.py", line
250, in Main
take_action(rps)
File "/usr/lib/python2.3/site-packages/rdiff_backup/Main.py", line
222, in take_action
elif action == "backup": Backup(rps[0], rps[1])
File "/usr/lib/python2.3/site-packages/rdiff_backup/Main.py", line
260, in Backup
backup_init_dirs(rpin, rpout)
File "/usr/lib/python2.3/site-packages/rdiff_backup/Main.py", line
318, in backup_init_dirs
ErrorLog.open(Time.curtimestr, compress = Globals.compression)
File "/usr/lib/python2.3/site-packages/rdiff_backup/log.py", line
219, in open
cls._log_fileobj = cls._log_inc_rp.open("wb", compress = compress)
File "/usr/lib/python2.3/site-packages/rdiff_backup/rpath.py", line
801, in open
if compress: return gzip.GzipFile(self.path, mode)
File "/usr/lib/python2.3/gzip.py", line 94, in __init__
fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb')
IOError: invalid mode: wb
Without knowing the rdiff to well I could guess this is somehow related
to the compressing of files on the fat drive or so so I try to invoke
the program the no-compress option:Traceback (most recent call last):
File "/usr/bin/rdiff-backup", line 23, in ?
rdiff_backup.Main.Main(sys.argv[1:])
File "/usr/lib/python2.3/site-packages/rdiff_backup/Main.py", line
250, in Main
take_action(rps)
File "/usr/lib/python2.3/site-packages/rdiff_backup/Main.py", line
222, in take_action
elif action == "backup": Backup(rps[0], rps[1])
File "/usr/lib/python2.3/site-packages/rdiff_backup/Main.py", line
260, in Backup
backup_init_dirs(rpin, rpout)
File "/usr/lib/python2.3/site-packages/rdiff_backup/Main.py", line
318, in backup_init_dirs
ErrorLog.open(Time.curtimestr, compress = Globals.compression)
File "/usr/lib/python2.3/site-packages/rdiff_backup/log.py", line
219, in open
cls._log_fileobj = cls._log_inc_rp.open("wb", compress = compress)
File "/usr/lib/python2.3/site-packages/rdiff_backup/rpath.py", line
801, in open
if compress: return gzip.GzipFile(self.path, mode)
File "/usr/lib/python2.3/gzip.py", line 94, in __init__
fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb')
IOError: invalid mode: wb
This traceback is a little bit different but the error is still the same
so maybe I was way of in my last guess. Anyone know if this is a known
bug or have a workaround? I need to use fat32 on the drive because I
need to be able to acces it from Windows also.

Tim
Jul 18 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Tim Gahnstrom wrote:
rdiff-backup is aperently written in Python and when I run it in a
special way I get some funy Python errors. Does anyone know if linux .... File "/usr/lib/python2.3/gzip.py", line 94, in __init__
fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb')
IOError: invalid mode: wb


That line "should" execute, AFAICS. Try this, after changing the
directory to the drive that is failing:

-bash-2.05b$ python
Python 2.3.3 (#1, May 7 2004, 10:31:40)
[GCC 3.3.3 20040412 (Red Hat Linux 3.3.3-7)] on linux2
import gzip
gzip.GzipFile('test.file', 'w')


If it reports the same error, then the problem is just in Python
or your USB (or FAT32) drive.

If it doesn't report the same error, it seems likely that rdiff-backup
has substituted the builtin open() function with its own, for reasons
unknown... At least, that's the only thought that occurs to me.

-Peter
Jul 18 '05 #2

P: n/a
Peter Hansen wrote:
Tim Gahnstrom wrote:
rdiff-backup is aperently written in Python and when I run it in a
special way I get some funy Python errors. Does anyone know if linux
File "/usr/lib/python2.3/gzip.py", line 94, in __init__
fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb')
IOError: invalid mode: wb

That line "should" execute, AFAICS. Try this, after changing the
directory to the drive that is failing:

-bash-2.05b$ python
Python 2.3.3 (#1, May 7 2004, 10:31:40)
[GCC 3.3.3 20040412 (Red Hat Linux 3.3.3-7)] on linux2 >>> import gzip
>>> gzip.GzipFile('test.file', 'w')
If it reports the same error, then the problem is just in Python
or your USB (or FAT32) drive.

If it doesn't report the same error, it seems likely that rdiff-backup
has substituted the builtin open() function with its own, for reasons
unknown... At least, that's the only thought that occurs to me.

import gzip
gzip.GzipFile('test.file', 'w') <gzip open file 'test.file', mode 'wb' at 0x5505b1e0 0x5506088c>


Hmm, that seemed to work like a charm so off to look for an other source
of the error.

thanks

Tim
Jul 18 '05 #3

P: n/a
Tim Gahnstrom wrote:
Does anyone know if linux
python have some issues with working with fat32 or usb drives?


Since I also use Fedora Core 2 and usb drives, id like to point out that
I didnt had any troubles with my USB drive, altho its on FAT16 (64 mb of
disk space :) )

As far as I know, mounting usb drives (in Fedora) is doable by root only
unless you hack your way out, so trying to open() it with write
attribute would fail if you're not root.

I would make sure the /mnt/usbdrive doesnt belong to root first (chown it).

--
Eric Belanger
(E-mail in the header is obviously fake (spam-proof),
but guessable.)
Jul 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.