Open flywire opened 9 years ago
Yes, that's a correct way to invoke win-unicode-console
. The idea is that you want to call win_unicode_console.enable()
automatically on every startup. A way to do this is to use sitecustomize
or usercustomize
. Of course if you want to access win_unicode_console
module, you have to import it.
If you put the customizing script on a user-specific path, it's typically called usercustomize
. You can also put sitecustomize
to the global site-packages
directory – Python/Lib/site-packages/
.
An easy way to see whether win-unicode-console
is active is to try to print some Unicode characters (that's why are you installing win-unicode-console
in the first place) or to see what sys.stdout
is.
Sorry, my communication has not been effective.
I am just an average moron not particularly interested in unicode characters but software that I want to use would not work. Assume I don't know what a unicode character is or how to call win_unicode_console.enable() (which is actually the case). Given that it will not work without the import line (which is not documented), I suggest that readme is changed so that that Usage, Python patch (recommended) reads: import win_unicode_console win_unicode_console.enable()
Can you provide a line in the readme that will attempt to print some unicode characters and describe success and failure?
The readme is written for someone who knows Python, e.g. it should be clear that win_unicode_console.enable
is a Python function and calling it means just calling the function, also it should be clear that win_unicode_console
is a module, so if one wants to access it, he has to import it first. The usage desription focuces on the core idea – how to achieve that win_unicode_console.enable()
gets called on every Python startup.
Maybe I should write a short text for beginners showing the problem and a solution on examples.
To solve your particular issue – what software are you using and what how exactly wouldn't it work? If you run Python interactive intepreter and type print(u"\u03b1")
, what happens?
Well not everyone that can google is a python programmer so I think a beginners section would be really worthwhile. I was lucky to get a python programmer to take me through it.
Until the issues are sorted with the standard Python installation package we can only encourage windows users to use the win-unicode-console package. For that I thank you.
some recommendations for how to use with tox or other virtualenvs without system site packages enabled would be helpful too.
@jrobeson Doesn't those environments have their own local site-packages? Or how do you install packages there? Do you have any recommendations?
I'm actually rather new to this stuff in python, that's why I asked :)
I realize that tox can have it's own non-package dependencies, so it's not actually much of a concern there!
Well I have no experience with tox or other virtual environments, but I suppose, that packages are important part of environments, so there is a standard way to install packages into a virtual environment. So you install win_unicode_console
a any other package and you modify the local sitecustomize
the same way you would modify the local one. In conclusion I'm not aware of any special situation when using virtual environments.
What do you mean by no-accept-encodings
?
i deleted it. I thought i commenting on another project. Sorry! :(
there's no reasonable way to modify sitecustomize
in tox as far as I can tell.
So does it provide any other startup hook?
not that I know of. you might be able to do it manually in the commands
section though.
Maybe something here would help: https://testrun.org/tox/latest/plugins.html . Anyway, it seems that this reduces to the question “How to run custom code at startup in tox
?“, which is not directly related to win_unicode_console
. However, if you find an answer, I'll be happy to put it into the documentation eventually.
"Different ways of how win_unicode_console can be used to fix a Python environment on Windows follow.
Python patch (recommended). Just call win_unicode_console.enable() in your sitecustomize or usercustomize module (see https://docs.python.org/3/tutorial/appendix.html#the-customization-modules for more information). This will enable win_unicode_console on every run of the Python interpreter (unless site is disabled). Doing so should not break executed scripts in any way."
This returned a path that did not exist. I created the path and sitecustomize.py file with a single line: win_unicode_console.enable()
I got an error so I changed it to the two lines: import win_unicode_console win_unicode_console.enable()
Please confirm correct installation and provide a simple validation test.
Running Win7-32