tslocum / aafm

!!! Use https://gitlab.com/tslocum/adbfm instead !!! Android ADB file manager
Other
27 stars 4 forks source link

Use C locale or the script fails if the system is not using a C compatible locale #29

Open tslocum opened 10 years ago

tslocum commented 10 years ago

Issue by sole Monday Mar 19, 2012 at 10:11 GMT Originally opened as https://github.com/sole/aafm/issues/29


As mentioned in https://github.com/sole/aafm/pull/11#issuecomment-4568349

tslocum commented 10 years ago

Comment by nbigaouette Sunday Mar 17, 2013 at 19:35 GMT


I am hit by that:

$ locale
LANG=fr_CA.UTF-8
LC_CTYPE="fr_CA.UTF-8"
LC_NUMERIC="fr_CA.UTF-8"
LC_TIME="fr_CA.UTF-8"
LC_COLLATE="fr_CA.UTF-8"
LC_MONETARY="fr_CA.UTF-8"
LC_MESSAGES="fr_CA.UTF-8"
LC_PAPER="fr_CA.UTF-8"
LC_NAME="fr_CA.UTF-8"
LC_ADDRESS="fr_CA.UTF-8"
LC_TELEPHONE="fr_CA.UTF-8"
LC_MEASUREMENT="fr_CA.UTF-8"
LC_IDENTIFICATION="fr_CA.UTF-8"
LC_ALL=
$ aafm 
EXECUTE= adb shell ls --help
BusyBox ls detected
EXECUTE= adb shell ls -l -A -e --color=never /mnt/sdcard/
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/aafm/aafm-gui.py", line 808, in <module>
    gui = Aafm_GUI()
  File "/usr/lib/python2.7/site-packages/aafm/aafm-gui.py", line 142, in __init__
    self.refresh_device_files()
  File "/usr/lib/python2.7/site-packages/aafm/aafm-gui.py", line 188, in refresh_device_files
    self.device_treeViewFile.load_data(self.dir_scan_device(self.device_cwd))
  File "/usr/lib/python2.7/site-packages/aafm/aafm-gui.py", line 319, in dir_scan_device
    entries = self.aafm.get_device_file_list()
  File "/usr/lib/python2.7/site-packages/aafm/Aafm.py", line 56, in get_device_file_list
    return self.parse_device_list( self.device_list_files( self._path_join_function(self.device_cwd, '') ) )
  File "/usr/lib/python2.7/site-packages/aafm/Aafm.py", line 98, in parse_device_list
    timestamp = time.mktime((time.strptime(match.group('datetime'), date_format)))
  File "/usr/lib/python2.7/_strptime.py", line 454, in _strptime_time
    return _strptime(data_string, format)[0]
  File "/usr/lib/python2.7/_strptime.py", line 325, in _strptime
    (data_string, format))
ValueError: time data 'Sun Feb 17 12:27:50 2013' does not match format '%a %b %d %H:%M:%S %Y'

Launching with:

$ LANG=C aafm
EXECUTE= adb shell ls --help
BusyBox ls detected
EXECUTE= adb shell ls -l -A -e --color=never /mnt/sdcard/

works.

tslocum commented 10 years ago

Comment by sole Monday Mar 18, 2013 at 08:42 GMT


Nice! Do you know of a way of changing the locale from inside Python? Or will be need to launch aafm with a bash script? (I'd rather keep it all inside Python)

Thanks for helping :-)