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

getdefaultlocale returns None.... #6

Open
pconesa opened this issue Aug 5, 2021 · 2 comments · Fixed by scipion-em/tkColorPicker#1
Open

getdefaultlocale returns None.... #6

pconesa opened this issue Aug 5, 2021 · 2 comments · Fixed by scipion-em/tkColorPicker#1

Comments

@pconesa
Copy link

pconesa commented Aug 5, 2021

Hi!
Thanks for having this, is much better than default tk color picker in ubuntu!

Nevertheless, we have this specific issue:

from tkcolorpicker.colorpicker import ColorPicker, askcolor

File "/home/coss/scipion3/.scipion3env/lib/python3.6/site-packages/tkcolorpicker/colorpicker.py", line 43, in
if getdefaultlocale()[0][:2] == 'fr':
TypeError: 'NoneType' object is not subscriptable
Error at main: 'NoneType' object is not subscriptable

I believe in this case it should fallback to English.

@EricDeveaud
Copy link

I have the same problem with tkcolorpicker-2.1.3.
when LC_ALL is set to C
any other value seems to pass

maestro-builder:~ > echo $LC_ALL 
C

LC_ALL=C python -W ignore -m tkcolorpicker.colorpicker
Traceback (most recent call last):
File "/opt/gensoft/adm/Python/3.8/lib/python3.8/runpy.py", line 184, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "/opt/gensoft/adm/Python/3.8/lib/python3.8/runpy.py", line 110, in _get_module_details
import(pkg_name)
File "/opt/gensoft/exe/scipion/3.0.10/.scipion3/lib/python3.8/site-packages/tkcolorpicker/init.py", line 21, in
from tkcolorpicker.colorpicker import ColorPicker, askcolor
File "/opt/gensoft/exe/scipion/3.0.10/.scipion3/lib/python3.8/site-packages/tkcolorpicker/colorpicker.py", line 43, in
if getdefaultlocale()[0][:2] == 'fr':
TypeError: 'NoneType' object is not subscriptable
(.scipion3) maestro-builder:~ > LC_ALL=C.utf8 python -W ignore -m tkcolorpicker.colorpicker
(.scipion3) maestro-builder:~ > LC_ALL=fr_FR python -W ignore -m tkcolorpicker.colorpicker
(.scipion3) maestro-builder:~ > LC_ALL=fr_FR.utf8 python -W ignore -m tkcolorpicker.colorpicker
(.scipion3) maestro-builder:~ > LC_ALL=en_US python -W ignore -m tkcolorpicker.colorpicker


even non local value is accepted.

(.scipion3) maestro-builder:~ > LC_ALL=foo python -W ignore -m tkcolorpicker.colorpicker


regards



@pconesa
Copy link
Author

pconesa commented May 11, 2022

I think the source of the problem resides on a bad locale configuration in the system, but it would be nice to make this tolerant to it, if possible.

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

Successfully merging a pull request may close this issue.

2 participants