Closed archey closed 10 years ago
I know its not your fault directly but a fault of the upstream, but I wanted to know if you had seen this before in your testing.
I haven't seen this before in my testing. It appears that Click raises this exception if locale.getpreferredencoding() fails or is set to 'ascii'. Could you run python -c "print(__import__('locale').getpreferredencoding())"
and put the output here?
If it outputs 'ascii' then you will have to set the system locale to utf8, not the script itself. I'm not really happy with Click quitting like that with such an unhelpful error message, I might remove that dependency.
$ python -c "print(import('locale').getpreferredencoding())" ANSI_X3.4-1968
Yeah, so your system's preferred encoding is ASCII rather than Unicode which Click apparently discourages. I'm not happy with it terminating like that, so unless you can force LC_ALL=en_US.UTF-8
(or another UTF-8 locale) I'm going to have to remove Click :/
My only issue with forcing the locale is that it could cause issues for users who have a different locale then US.UTF-8. The only way I can see to fix it is we can add instr to it to tell users to set their locale in a wrapper script. But I don't think that really works very well either, as your setup.py drops xcat under /usr/bin/ so it makes it difficult to wrap around. Plus I see this being an issue with other users and distros down the road.
Yeah, I see. I will work on removing Click and adding a warning when it starts: XCat should function fine in an ascii environment, the only trouble will come when extracting unicode data from a site.
I'm swamped with work at the moment so that won't happen for a month or so, but I can ping you an email when I get it done. Or alternatively I can quickly add a more informative warning to XCat before it terminates instructing the user to set a unicode locale?
Feel free to ping me once its ready, we will hold off including it until then if thats all right with you.
Do you happen to have a twitter that we can use to add you to our tools list for credit on the tool?
Nope, I don't use Twitter. If you could add a link to my blog instead (http://tomforb.es) that would be great :)
Will do I will update our site right now with your gh name and link to the site
actually nvm its already done lol:
I was curious if you saw these issues with click and python3:
Traceback (most recent call last): File "/usr/bin/xcat", line 9, in
load_entry_point('xcat==0.7.1', 'console_scripts', 'xcat')()
File "/usr/lib/python3.4/site-packages/xcat/xcat.py", line 290, in run
xcat(obj={})
File "/usr/lib/python3.4/site-packages/click/core.py", line 488, in call
return self.main(_args, *_kwargs)
File "/usr/lib/python3.4/site-packages/click/core.py", line 451, in main
raise RuntimeError('Click will abort further execution '
RuntimeError: Click will abort further execution because Python 3 was configured to use ASCII as encoding for the environment. Either switch to Python 2 or consult http://click.pocoo.org/python3/ for mitigation steps.
http://click.pocoo.org/python3/
I could be wrong, but per your docs this code is written in py3 and compatible up to py3.4. I will see if I can mitigate around it per their docs, but it might be difficult for different users. Since it requires modifying the locale in the script to fix the issue with ascii encoding.