View Issue Details

IDProjectCategoryView StatusLast Update
0003590ArchBugpublic2018-12-17 14:26
Reporterfurti Assigned Toyorik  
PrioritynormalSeverityblockReproducibilityalways
Status closedResolutionfixed 
Product Version0.18 
Target Version0.18Fixed in Version0.18 
Summary0003590: Arch Py3 unicode problems
DescriptionSome commands in Arch workbench do not work with a 0.18 Py3 build because of problems with byte like object instead og unicode string.

See:
http://forum.freecadweb.org/viewtopic.php?t=30824

http://forum.freecadweb.org/viewtopic.php?t=30826

http://forum.freecadweb.org/viewtopic.php?t=30825
Tagsunicode
FreeCAD Information

Activities

furti

2018-09-11 17:15

reporter   ~0011710

Last edited: 2018-09-11 17:43

The linked forum threads contain the relevant informations like steps to reproduce and FreeCAD info

Kunda1

2018-09-11 17:42

administrator   ~0011711

assigning to yorik

Kunda1

2018-10-15 07:17

administrator   ~0012028

Set this as 'Block' since 0.18 will be py3 compliant.

looo

2018-10-16 10:40

developer   ~0012037

I think this is a pivy problem. I guess SoAsciiString.text.setValues() should work with bytes-objects. Currently it works with unicode-objects (py3) but doesn't show special-symbols. Can anyone approve this assumption?

looo

2018-10-16 11:46

developer   ~0012039

Last edited: 2018-10-16 11:46

I guess this is the relevant part where the problem occurs:


          arg4[i] = PyBytes_AsString(PyUnicode_AsEncodedString(item, "utf-8", "Error ~"));

No idea why swig creates this, as pivy defines the typemap in another way:
https://github.com/FreeCAD/pivy/blob/master/Inventor/fields/SoMFString.i#L12

looo

2018-10-16 12:59

developer   ~0012040

Last edited: 2018-10-16 13:02

This should fix the problem. The reason for the problem:

The c-function "PyObject_Str" is the same as "str" in python. Calling this function will convert any object to a unicode-object in python3. This results in things like "b'\xc2\abc...'"

https://github.com/FreeCAD/pivy/pull/43

edit: solves only http://forum.freecadweb.org/viewtopic.php?t=30824
the other 2 are still there, but should be easier to fix.

wmayer

2018-10-17 09:35

administrator   ~0012045

https://github.com/FreeCAD/FreeCAD/commit/1e6818b6fbf86ad08d8fc85252dddcae8891dd54

yorik

2018-12-17 14:26

administrator   ~0012291

Remaining problems fixed in http://github.com/FreeCAD/FreeCAD/commit/175566d55

Issue History

Date Modified Username Field Change
2018-09-11 17:10 furti New Issue
2018-09-11 17:15 furti Note Added: 0011710
2018-09-11 17:42 Kunda1 Assigned To => yorik
2018-09-11 17:42 Kunda1 Status new => assigned
2018-09-11 17:42 Kunda1 Note Added: 0011711
2018-09-11 17:42 Kunda1 Target Version => 0.18
2018-09-11 17:43 Kunda1 Note Edited: 0011710
2018-10-15 07:15 Kunda1 Tag Attached: unicode
2018-10-15 07:17 Kunda1 Severity major => block
2018-10-15 07:17 Kunda1 Note Added: 0012028
2018-10-16 10:40 looo Note Added: 0012037
2018-10-16 11:46 looo Note Added: 0012039
2018-10-16 11:46 looo Note Edited: 0012039
2018-10-16 12:59 looo Note Added: 0012040
2018-10-16 13:02 looo Note Edited: 0012040
2018-10-17 09:35 wmayer Note Added: 0012045
2018-12-17 14:26 yorik Note Added: 0012291
2018-12-17 14:26 yorik Status assigned => closed
2018-12-17 14:26 yorik Resolution open => fixed
2018-12-17 14:26 yorik Fixed in Version => 0.18