Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

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

Open
tslocum opened this issue Aug 24, 2014 · 2 comments
Labels

Comments

@tslocum
Copy link
Owner

tslocum commented Aug 24, 2014

Issue by sole
Monday Mar 19, 2012 at 10:11 GMT
Originally opened as sole#29


As mentioned in sole#11 (comment)

@tslocum
Copy link
Owner Author

tslocum commented Aug 24, 2014

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
Copy link
Owner Author

tslocum commented Aug 24, 2014

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 :-)

@tslocum tslocum added the bug label Aug 24, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant