* Martin Michlmayr <[EMAIL PROTECTED]> [2005-06-19 23:14]:
> because it is always possible that the filename contains ": ".
> 
> 
> diff -urN jack-3.1.1~/jack_helpers.py jack-3.1.1/jack_helpers.py
> --- jack-3.1.1~/jack_helpers.py       2005-06-19 23:07:23.931776104 +0100
> +++ jack-3.1.1/jack_helpers.py        2005-06-19 23:08:03.155813144 +0100
> @@ -216,9 +216,12 @@
>  if len (s) >= 2: s = s[-2]
>  if len (s) == 1: s = s[0]       
>  y0 = string.find(s, ": ")             

.rfind would be even better because of the possible problem mentioned
above.


diff -urN jack-3.1.1~/jack_helpers.py jack-3.1.1/jack_helpers.py
--- jack-3.1.1~/jack_helpers.py 2005-06-19 23:07:23.931776104 +0100
+++ jack-3.1.1/jack_helpers.py  2005-06-19 23:37:31.759944448 +0100
@@ -215,10 +215,13 @@
 s = string.split(i['buf'], '\r')    
 if len (s) >= 2: s = s[-2]
 if len (s) == 1: s = s[0]       
-y0 = string.find(s, ": ")             
-y1 = string.find (s, "%")
+y0 = string.rfind(s, ": ")             
+y1 = string.find (s, "%", y0)
 if y0 != -1 and y1 != -1: 
-    percent = float(s[y0 + 1:y1])
+    try:
+        percent = float(s[y0 + 1:y1])
+    except ValueError:
+        percent = 0
 else:                   
     percent = 0         
 """,

-- 
Martin Michlmayr
http://www.cyrius.com/


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to