Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
sole opened this issue Mar 19, 2012 · 2 comments
Labels

Comments

@sole
Copy link
Owner

sole commented Mar 19, 2012

As mentioned in #11 (comment)

@nbigaouette
Copy link

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.

@sole
Copy link
Owner Author

sole commented Mar 18, 2013

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants