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

Bug#612334: vusb-analyzer: Doesn't work when locale is set to pl_PL.UTF-8

tags 612334 + confirmed patch

* Patryk Ściborek <patryk@sciborek.com>, 2011-02-07, 20:53:
scibi@karaluszek:~$ vusb-analyzer /tmp/windows-storage-mount.log
Warning: psyco not found, install it for a nice speed boost.
Loaded decoder module 'Cypress'
Loaded decoder module 'Storage'
Loaded decoder module 'Bluetooth'
Exception in thread Thread-1:
Traceback (most recent call last):
 File "/usr/lib/python2.6/threading.py", line 532, in __bootstrap_inner
 File "/usr/lib/vusb-analyzer/VUsbTools/Log.py", line 696, in run
 File "/usr/lib/vusb-analyzer/VUsbTools/Log.py", line 183, in parse
   UsbIOParser.parse(self, l[1][:-1], self.parseRelativeTime(line),
 File "/usr/lib/vusb-analyzer/VUsbTools/Log.py", line 190, in
   t = self.parseTime(line)
 File "/usr/lib/vusb-analyzer/VUsbTools/Log.py", line 207, in parseTime
   parsed = time.strptime(stamp, "%b %d %H:%M:%S")
 File "/usr/lib/python2.6/_strptime.py", line 454, in _strptime_time
   return _strptime(data_string, format)[0]
 File "/usr/lib/python2.6/_strptime.py", line 325, in _strptime
   (data_string, format))
ValueError: time data 'Jan 11 23:40:52' does not match format '%b %d

Thanks for the bug report. Could you check if the attached patch fixes all the locale problems for you?

Jakub Wilk
Description: Set LC_TIME locale to C, so that timestamps can be parsed
Author: Jakub Wilk <jwilk@debian.org>
Bug-Debian: http://bugs.debian.org/612334
Forwarded: no
Last-Update: 2011-02-07

--- a/vusb-analyzer
+++ b/vusb-analyzer
@@ -9,7 +9,12 @@
 VERSION = "1.1"
-import sys, os, gtk
+import sys, os, gtk, locale
+# gtk "helpfully" calls setlocale(LC_ALL, ""), which breaks timestamp
+# parsing. Let's (partially) undo that.
+locale.setlocale(locale.LC_TIME, 'C')
 from VUsbTools import Views, Log, Diff, Decode
 def main(filename, tailMode=False):

Reply to: