deskbar-applet r2171 - in trunk: . deskbar/handlers



Author: sebp
Date: Fri May 23 11:24:26 2008
New Revision: 2171
URL: http://svn.gnome.org/viewvc/deskbar-applet?rev=2171&view=rev

Log:
Use subprocess module instead of os.popen.
Catch OSError when retrieving version (fixes bug #533842)

Modified:
   trunk/ChangeLog
   trunk/deskbar/handlers/tomboy.py

Modified: trunk/deskbar/handlers/tomboy.py
==============================================================================
--- trunk/deskbar/handlers/tomboy.py	(original)
+++ trunk/deskbar/handlers/tomboy.py	Fri May 23 11:24:26 2008
@@ -9,7 +9,7 @@
 import deskbar.interfaces.Module
 import gtk
 import logging
-import os
+import subprocess
 import re
 
 LOGGER = logging.getLogger(__name__)
@@ -242,9 +242,14 @@
 # If we use DBus, it will wake up Tomboy even if 
 # this module isn't enabled.
 def get_tomboy_version():
-    command = os.popen("tomboy --version")
-    read = command.read()
-    command.close()
+    try:
+        command = subprocess.Popen("tomboy --version", shell=True,
+                                   stdout=subprocess.PIPE).stdout
+        read = command.read()
+        command.close()
+    except OSError, e:
+        LOGGER.exception(e)
+        return '0.0.0'
     
     line_regexp = re.compile( 'Version (\d+?)\.(\d+?)\.(\d+?)', re.IGNORECASE )
     results_list = line_regexp.findall( read )



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]