Any Python experts that are also Ubuntu Linux users out there?

I wound up having to do an unanticipated update of Ubuntu on my Acer Aspire Revo last night, after I installed an upgrade that apparently installed a new Linux kernal that broke my video driver, which I could have easily fixed had I spent a few minutes on Google but I foolishly charged ahead and did something dumb and pretty much hosed the system.  :(   At that point it was easier to just reinstall Ubuntu from scratch, so I decided to upgrade a couple of versions while I was at it, going from Ubuntu 9.10 to Ubuntu 10.10.  I’m actually glad I did, because apparently the Ubuntu folks have actually started supporting the Revo, so you no longer have to jump through hoops to get your sound and video working (it’s basically a few clicks to install the Nvidia video driver, and you’re all set).

But I did have one thing that stopped working.  On the old system, I had installed Mumbles to receive network Growl notifications.  While I can still install and run it, the moment it receives a notification it generates an error, and all I get is a blank white popup box. If I run it from a terminal window so that I can see the error messages, it throws up this error:

Traceback (most recent call last):
File “/home/htpc/mumbles0.4-branch/src/MumblesNotify.py”, line 354, in expose
cr.reset_clip()
TypeError: Required argument ‘cr’ (pos 1) not found

Line 354 of MumblesNotify.py contains a single instruction:

cr.reset_clip()

So I wondered what would happen if I commented it out.  Well, when I do that and re-run the software, then I get:

/home/htpc/mumbles0.4-branch/src/MumblesNotify.py:374: DeprecationWarning: use copy pango.FontDescription.set_family instead
p_fdesc.set_family_static(self.options.get_option(CONFIG_MT, ‘text_title_font’))
Traceback (most recent call last):
File “/home/htpc/mumbles0.4-branch/src/MumblesNotify.py”, line 393, in expose
cr.reset_clip()
TypeError: Required argument ‘cr’ (pos 1) not found

Line 374 contains:
p_fdesc.set_family_static(self.options.get_option(CONFIG_MT, ‘text_title_font’))

And line 393 contains:
cr.reset_clip()

Ugh, that again! So I commented out those two lines and now the script runs without error, but it only displays the caller’s name (in a rather ugly font) and not the calling number. It seems that if those three lines could be fixed, it might run without issue, but since I don’t know the first thing about Python (nor what changed in the last couple version of Ubuntu that might cause it to stop working) I have no idea how to fix it. If anyone could enlighten me, I’d much appreciate it!

EDIT: The fix is in the comments on this post – thanks much to Joe for pointing it out!

3 Comments »

  1. It’s trying to read the font definition from the options passed when that class was instantiated (self.options) and then call the function cr.reset_clip(), presumably to apply the font. However, that function requires at least one argument, cr, in position one (and possibly others), and nothing is being passed to it, hence it throws an error. When you run it without that function, presumably the font is set to a system default value.

    If you know what/where CONFIG_MT is, you might want to check its contents.

  2. Joe said

    There is a patch included in this bug report that fixed the issue:

    https://bugzilla.redhat.com/show_bug.cgi?id=571352

    The line numbers are different presumably due to distribution differences (fedora vs ubuntu), but the reported error is the same.

  3. Joe, thank you, that works — as you say, the line numbers are different, but I just loaded the file into a text editor and manually removed the lines with a – in front of them, and added the ones with a + in front of them, using this patch file as a guide (note that these changes are to ~/mumbles0.4-branch/src/MumblesNotify.py):

    --- MumblesNotify.py.orig	2010-10-19 14:58:58.224486762 -0500
    +++ MumblesNotify.py	2010-10-19 14:59:28.498736347 -0500
    @@ -240,6 +240,7 @@ class MumblesNotify(object):
     	def expose(self, widget, event, title, message, image):
     
     		cr = widget.window.cairo_create()
    +		cr.save()
     
             	# restrict to window area
     		cr.rectangle(event.area.x, event.area.y, event.area.width, event.area.height)
    @@ -277,7 +278,8 @@ class MumblesNotify(object):
     		if plugin_image:
     			widget.window.draw_pixbuf(None, plugin_image, 0, 0, self.options.get_option(CONFIG_MT, 'icon_x_pos'), self.options.get_option(CONFIG_MT, 'icon_y_pos'))
     
    -		cr.reset_clip()
    +		cr.restore()
    +		cr.save()
     
     		# add the title
     		text_title_width = self.options.get_option(CONFIG_MT, 'text_title_width')
    @@ -312,7 +314,7 @@ class MumblesNotify(object):
     		cr.set_source_rgba(c[0], c[1], c[2])
     		cr.show_layout(p_layout_title)
     
    -		cr.reset_clip()
    +		cr.restore()
     
     		# add the message
     		text_message_width = self.options.get_option(CONFIG_MT, 'text_message_width')
    

RSS feed for comments on this post · TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 120 other followers