unit: unit 1.29 unexpected returns getfilesystemencoding is ascii
debian 11, all locale settings *.uft-8
system (as before):
$ python
Python 3.9.2 (default, Feb 28 2021, 17:03:44)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.getfilesystemencoding()
'utf-8'
but in application (django) launched on unit + unit-python3.9 sys.getfilesystemencoding() returns after update (from 1.28 to 1.29) ‘ascii’ (with appropriate ancient spell “UnicodeEncodeError: ‘ascii’ codec can’t encode characters in position” etc)
maybe it"s related to this?:
Feature: support per-application cgroups on Linux.
(nothing more suitable)
after updates-rollback is everything works. i read docs, issues, maybe i missed something?
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 19 (12 by maintainers)
Commits related to this issue
- Python: Fix enabling of UTF-8 in some situations. There was a couple of reports of Python applications failing due to the following type of error File "/opt/netbox/netbox/netbox/configuration.py", l... — committed to nginx/unit by ac000 a year ago
- Python: Fix enabling of UTF-8 in some situations. There was a couple of reports of Python applications failing due to the following type of error File "/opt/netbox/netbox/netbox/configuration.py", l... — committed to nginx/unit by ac000 a year ago
Just compiled unit with this patch. No longer see any ascii related issues logged at all Hope all others will have same result 🫡
This patch seems to do the right thing and will enable UTF-8 depending on the setting of the LC_CTYPE environment variable (this is the default behaviour when using the non-isolated python config).
So if LC_CTYPE is either: C, POSIX or some specific UTF-8 locale then you will get UTF-8 support.
So for Python 3.8+ when you have the
homeoption set we now go through the PyConfig API.When this happens
config.filesystem_encodingdefaults to NULL if not set (which we don’t) which seems to be the cause of the issue.There’s a simple patch you could try to verify this…
When we don’t go this route things seem to work out as before.
Sill some work to be done…
So it seems virtualenv is what tickles this particular bug. Don’t know much about it but this looks like a crucial piece of information. Thanks!.