rdff-backup / python linux fat32

T

Tim Gahnstrom

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
 
P

Peter Hansen

Tim said:
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
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
 
T

Tim Gahnstrom

Peter said:
Tim said:
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
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.

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

thanks

Tim
 
E

Eric Belanger

Tim said:
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).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top