View Issue Details

IDProjectCategoryView StatusLast Update
0002238FreeCADBugpublic2021-04-11 13:48
Reportergozreh Assigned Towmayer  
PrioritynormalSeveritycrashReproducibilityalways
Status closedResolutionfixed 
Platform64 Bit (i7-3740QM )OSWindowsOS Version7 Ultimate
Product Version0.15 
Fixed in Version0.16 
Summary0002238: Python: Environment Variable 'path' with mutated vowel (german: Umlaut [äöüß])
DescriptionIf the path contain a non-ascii character obove 127 the function
Py_Initialize() fails with no return value.
Therefore the user is left alone with this problem.
Steps To Reproduce1. Add 'path' with a character 'ü' in it.
2. Start FreeCad
Additional InformationTested with character 'ü'.
TagsNo tags attached.
FreeCAD Information

Relationships

has duplicate 0002452 closedwmayer Don't started FreeCAD after install in Windows 7 with locale ru_RU 

Activities

wmayer

2015-09-05 11:02

administrator   ~0006333

YMMD!

This is a nasty bug which also regularly appears in the forum and I could never reproduce it.

However, for me it doesn't corrupt Py_Initialize but it much later throws an exception in the built-in script FreeCADInit.py at the line:
os.environ["PATH"] = PathExtension + os.environ["PATH"]

You can also demonstrate this problem directly in Python.
1. Open a terminal and enter e.g.: set PATH=%PATH%;C:\Temp\äöü
2. Start a Python session with python.exe
3. In the Python prompt enter:
import os
"test"+os.environ["PATH"] ## => nothing happens
4. Now enter this:
u"test"+os.environ["PATH"] ## => UnicodeDecodeError: 'ascii' codec can't decode byte 0xe4 in position 734: ordinal not in range(128)

Kunda1

2021-04-11 13:48

administrator   ~0015606

@wmayer do you mind reviewing this now that we're fully ported to Py3 ?


# new paths must be prepended to avoid to load a wrong version of a library
    try:
        os.environ["PATH"] = PathEnvironment + os.environ["PATH"]
    except UnicodeDecodeError:
        # See 0002238. FIXME: check again once ported to Python 3.x
        Log('UnicodeDecodeError was raised when concatenating unicode string with PATH. Try to remove non-ascii paths...\n')
source: https://github.com/FreeCAD/FreeCAD/blob/5d49bf78de785a536f941f1a6d06d432582a95d3/src/App/FreeCADInit.py#L67

Related Changesets

FreeCAD: master 4da63d1d

2015-09-05 14:52:06

wmayer

Details Diff
+ fixes 0002238: Python: Environment Variable 'path' with mutated vowel Affected Issues
0002152, 0002238
mod - src/App/FreeCADInit.py Diff File

Issue History

Date Modified Username Field Change
2015-09-02 10:38 gozreh New Issue
2015-09-05 11:02 wmayer Note Added: 0006333
2015-09-05 12:53 wmayer Changeset attached => FreeCAD Master master 4da63d1d
2015-09-05 12:53 wmayer Assigned To => wmayer
2015-09-05 12:53 wmayer Status new => closed
2015-09-05 12:53 wmayer Resolution open => fixed
2015-12-15 13:17 yorik Fixed in Version => 0.16
2016-02-20 09:31 wmayer Relationship added has duplicate 0002452
2021-04-11 13:48 Kunda1 Note Added: 0015606