Ticket #44 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

Exits disgracefully when nautilusburn isn't found

Reported by: Andy Assigned to: Andy
Priority: normal Milestone: Stable
Component: backend Version: 1.0
Severity: major Keywords:
Cc:

Description

Quoting jhb:

it's very bad that pybackpack crashes (silently) if nautilusburn isn't present or if the CD burner test doesn't work - is there some way to test those and disable that part of the program if they're absent

Agreed.

Change History

12/04/07 20:29:42 changed by jhb

in 0.5.0, the errors look like this (I'm documenting this here for the line numbers mostly): Traceback (most recent call last):

File "/sw/bin/pybackpack", line 2, in ?

from pybackpack import backuptool

File "/sw/lib/python2.4/site-packages/pybackpack/backuptool.py", line 18, in ?

from gui import GuiHandlers?

File "/sw/lib/python2.4/site-packages/pybackpack/gui.py", line 12, in ?

import nautilusburn

ImportError?: No module named nautilusburn

Commenting out line 12 of gui.py gives: Traceback (most recent call last):

File "/sw/bin/pybackpack", line 2, in ?

from pybackpack import backuptool

File "/sw/lib/python2.4/site-packages/pybackpack/backuptool.py", line 18, in ?

from gui import GuiHandlers?

File "/sw/lib/python2.4/site-packages/pybackpack/gui.py", line 22, in ?

from seteditor import SetEditor?

File "/sw/lib/python2.4/site-packages/pybackpack/seteditor.py", line 7, in ?

import nautilusburn

ImportError?: No module named nautilusburn

Commenting out line 7 of seteditor.py gives: Traceback (most recent call last):

File "/sw/bin/pybackpack", line 3, in ?

backuptool.StartUp?()

File "/sw/lib/python2.4/site-packages/pybackpack/backuptool.py", line 98, in StartUp?

pbp = BackupTool?()

File "/sw/lib/python2.4/site-packages/pybackpack/backuptool.py", line 34, in init

self.guihandlers = GuiHandlers?(self.widgets)

File "/sw/lib/python2.4/site-packages/pybackpack/gui.py", line 28, in init

self.seteditor = SetEditor?()

File "/sw/lib/python2.4/site-packages/pybackpack/seteditor.py", line 45, in init

self.find_cd_burners()

File "/sw/lib/python2.4/site-packages/pybackpack/seteditor.py", line 351, in find_cd_burners

sel = nautilusburn.DriveSelection?()

NameError?: global name 'nautilusburn' is not defined

Then, you need to comment out line 45 in seteditor.py (line 351 doesn't work because it expects sel to have methods (or something)), and line 95 in backuptool.py.

12/04/07 20:30:53 changed by jhb

Here's an idea - why don't you just have it return the "No CD burners found" error if nautilusburn isn't present? (Possibly with a "maybe you don't have nautilusburn" caveat)

13/04/07 08:36:09 changed by jhb

Ok, here's an example fix (I think this is the diff format you want). Basically, try to import nautilusburn, catch the ImportError? (an error message could be added here, I guess), and if the module is present then continue as normal. I guess I don't know if it works if you actually have nautilusburn! :) This would need to be done in a few places, including the import statements at the top.

--- /Users/joshuaba/Desktop/pybackpack-0.5.0/src/pybackpack/backuptool.py 2007-04-09 02:50:50.000000000 +0300 +++ backuptool.py 2007-04-13 10:30:39.000000000 +0300 @@ -92,7 +92,12 @@

pass #if the file doesn't exist, don't panic!

# detect what CD burners are available

- self.guihandlers.find_cd_burners() + try: + import nautilusburn + except ImportError?: + pass + else: + self.guihandlers.find_cd_burners()

def StartUp?():

pbp = BackupTool?()

13/04/07 10:09:08 changed by Andy

backuptool.py shouldn't really be patched to fix this bug. Besides importing a module into a class where it isn't required, it's not really handling the exception properly. Have a go at patching the nautilusburn import in gui.py instead, if you want. Also, try to keep to the indenting scheme used in the files. Older files such as gui.py use tabs to indent and the newer ones use spaces.

15/04/07 02:47:39 changed by Andy

  • status changed from new to closed.
  • resolution set to fixed.

The patches you emailed me were applied in [90], thanks.