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

Cocos console on MAC getting error (again) :ValueError: unknown locale: UTF-8 #16138

Closed
meiry opened this issue Jul 17, 2016 · 9 comments
Closed
Assignees
Milestone

Comments

@meiry
Copy link

meiry commented Jul 17, 2016

downloaded the latest version 3.12
this used to be in some of the previous versions ,
i executed : cocos new help
Got this error :

meirs-Mac-mini:cocos2d-x-3.12 meiryanovich$ cocos new help
Traceback (most recent call last):
  File "/Users/meiryanovich/Documents/cocos2d-x/cocos2d-x-3.12/tools/cocos2d-console/bin/cocos.py", line 22, in <module>
    import cocos_project
  File "/Users/meiryanovich/Documents/cocos2d-x/cocos2d-x-3.12/tools/cocos2d-console/bin/cocos_project.py", line 4, in <module>
    import cocos
  File "/Users/meiryanovich/Documents/cocos2d-x/cocos2d-x-3.12/tools/cocos2d-console/bin/cocos.py", line 936, in <module>
    language, encoding = locale.getlocale()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/locale.py", line 562, in getlocale
    return _parse_localename(localename)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/locale.py", line 475, in _parse_localename
    raise ValueError, 'unknown locale: %s' % localename
ValueError: unknown locale: UTF-8

i was able to fix this problem executing those commands in the shell :

meirs-Mac-mini:cocos2d-x-3.12 meiryanovich$ export LC_ALL=en_US.UTF-8
meirs-Mac-mini:cocos2d-x-3.12 meiryanovich$ export LANG=en_US.UTF-8

can it be combined in the setup.py or something ?
Thanks

@minggo
Copy link
Contributor

minggo commented Jul 18, 2016

@natural-law could you please take a look?

@natural-law
Copy link
Contributor

@meiry @minggo I don't think it should be added in setup.py. Because maybe it will be conflict with existing environment settings on user's machine.

But I think we can add the solution into FAQ or Documents. Then once user encountered the problem, they can find the solution.

@meiry After all, thanks for your feedback!

@meiry
Copy link
Author

meiry commented Jul 18, 2016

@minggo @natural-law
The realty ( my also ) is that i don't always go to search in FAQ or documents .
And i saw more then 4-5 users complain in the forums .
for new user it can be pain . it is basic .
What is the cause of this problem ? in previous versions it worked out of the box .
Also you can check with simple if/then if the LANG or LC_ALL are already set .

@meiry meiry changed the title Cocos consle on MAC getting error (again) :ValueError: unknown locale: UTF-8 Cocos console on MAC getting error (again) :ValueError: unknown locale: UTF-8 Jul 18, 2016
@natural-law
Copy link
Contributor

On my machine, the value of LANG & LC_ALL like this:

Bill:~ cocos2d-x$ echo $LC_ALL

Bill:~ cocos2d-x$ echo $LANG
zh_CN.UTF-8

It works well with the latest code of v3 branch.

And I found this in python issue system : https://bugs.python.org/issue18378
Maybe the problem only occurred on machines with special language or terminal settings. I'm sorry that I've no idea what's the right way to solve it.

@meiry
Copy link
Author

meiry commented Jul 18, 2016

looks like python + MAC problem .
try to catch the exception in python and print to STD out the suggested solution

@minggo
Copy link
Contributor

minggo commented Jul 25, 2016

@meiry can i close the issue since it is not a cocos2-x issue?

@natural-law
Copy link
Contributor

@minggo I've just checked the logic, I think it's necessary that catch the exception to solve the crash problem. I will do it later.
@meiry Thanks for your suggestion!

@meiry
Copy link
Author

meiry commented Jul 25, 2016

Sure , happy to help

natural-law pushed a commit to natural-law/cocos2d-x that referenced this issue Jul 25, 2016
Solve the crash problem of cocos console on some Mac machines. Related issue: cocos2d#16138
natural-law pushed a commit to natural-law/cocos2d-x that referenced this issue Jul 25, 2016
Solve the crash problem of cocos console on some Mac machines. Related issue: cocos2d#16138
@minggo minggo added this to the 3.13 milestone Jul 25, 2016
@minggo minggo closed this as completed Jul 25, 2016
@fd5788
Copy link

fd5788 commented Apr 20, 2017

just,export LC_CTYPE=en_US.UTF-8

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

No branches or pull requests

4 participants