[Osgeo4w-trac] [osgeo4w] #682: MSI and EXE installers: different Python locale settings leads to issues with the Python console script editor
OSGeo4W
trac_osgeo4w at osgeo.org
Wed Jun 23 01:39:54 PDT 2021
#682: MSI and EXE installers: different Python locale settings leads to issues
with the Python console script editor
------------------------+----------------------------
Reporter: andreaerdna | Owner: osgeo4w-dev@…
Type: defect | Status: new
Priority: major | Component: Package
Version: | Resolution:
Keywords: |
------------------------+----------------------------
Comment (by andreaerdna):
**OSGeo4W new repositroy, OSGeo4W console**:
{{{
F:\QGIS\SourceDir\qgis>python-qgis
Python 3.9.0 (tags/v3.9.0:9cf6752, Oct 5 2020, 15:34:40) [MSC v.1927 64
bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.environ['PYTHONUTF8']
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "F:\QGIS\SOURCE~1\qgis\apps\Python39\lib\os.py", line 679, in
__getitem__
raise KeyError(key) from None
KeyError: 'PYTHONUTF8'
>>> import sys
>>> sys.flags.utf8_mode
0
>>> import locale
>>> locale.getpreferredencoding(False)
'cp1252'
}}}
{{{
F:\QGIS\SourceDir\qgis>set PYTHONUTF8=1
F:\QGIS\SourceDir\qgis>python-qgis
Python 3.9.0 (tags/v3.9.0:9cf6752, Oct 5 2020, 15:34:40) [MSC v.1927 64
bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.environ['PYTHONUTF8']
'1'
>>> import sys
>>> sys.flags.utf8_mode
1
>>> import locale
>>> locale.getpreferredencoding(False)
'UTF-8'
}}}
{{{
F:\QGIS\SourceDir\qgis>set PYTHONUTF8=0
F:\QGIS\SourceDir\qgis>python-qgis
Python 3.9.0 (tags/v3.9.0:9cf6752, Oct 5 2020, 15:34:40) [MSC v.1927 64
bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.environ['PYTHONUTF8']
'0'
>>> import sys
>>> sys.flags.utf8_mode
0
>>> import locale
>>> locale.getpreferredencoding(False)
'cp1252'
}}}
**OSGeo4W new repositroy, QGIS Python console**:
{{{
sys.version
'3.9.0 (tags/v3.9.0:9cf6752, Oct 5 2020, 15:34:40) [MSC v.1927 64 bit
(AMD64)]'
os.environ['PYTHONUTF8']
Traceback (most recent call last):
File "F:\QGIS\SOURCE~1\qgis\apps\Python39\lib\code.py", line 90, in
runcode
exec(code, self.locals)
File "<input>", line 1, in <module>
File "F:\QGIS\SOURCE~1\qgis\apps\Python39\lib\os.py", line 679, in
__getitem__
raise KeyError(key) from None
KeyError: 'PYTHONUTF8'
sys.flags.utf8_mode
0
import locale
locale.getpreferredencoding()
'cp1252'
}}}
{{{
sys.version
'3.9.0 (tags/v3.9.0:9cf6752, Oct 5 2020, 15:34:40) [MSC v.1927 64 bit
(AMD64)]'
os.environ['PYTHONUTF8']
'1'
sys.flags.utf8_mode
0
import locale
locale.getpreferredencoding()
'cp1252'
}}}
{{{
sys.version
'3.9.0 (tags/v3.9.0:9cf6752, Oct 5 2020, 15:34:40) [MSC v.1927 64 bit
(AMD64)]'
os.environ['PYTHONUTF8']
'0'
sys.flags.utf8_mode
0
import locale
locale.getpreferredencoding()
'cp1252'
}}}
--
Ticket URL: <https://trac.osgeo.org/osgeo4w/ticket/682#comment:6>
OSGeo4W <http://trac.osgeo.org/osgeo4w>
OSGeo4W is the Windows installer and package environment for the OSGeo stack.
More information about the Osgeo4w-trac
mailing list