getfilesystemencoding() differs if called via configuration management

gue*_*tli 3 python environment-variables python-2.7

If a script gets called via configuration management (in my case salt-stack), it fails. If called via shell it works.

I used the tool dumpenv to differences of the environments.

The getfilesystemencoding() is different:

dumpenv-getfilesystemencoding-differs

The environment variables look not much different:

dumpenv-os-environment变量

What causes the getfilesystemencoding() to be wrong on the right side?

Python version: 2.7

zee*_*hio 5

所述getfilesystemencoding()文档,指向了nl_langinfo文档,提示LC_CTYPE用于确定的编码。

因此,如果您的环境合适,那么您LC_CTYPE="C.UTF-8"可能将其UTF-8作为getfilesystemencoding()输出(而不是ANSI_X3.4-1968(最好称为US-ASCII))。