Unicode filenames in the Materials module

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
tomkcook
Posts: 87
Joined: Wed Jul 20, 2016 3:39 pm

Unicode filenames in the Materials module

Post by tomkcook »

Commit 75b52c85b0b092ab79ccd26a8632a8be44c1486c changed line 73 of src/Mod/Material/Material.py to:

Code: Select all

Config.read(fileName, encoding='utf-8') # respect unicode filenames
But this causes the following stack trace in the CfdOF workbench:

Code: Select all

This mat card reader is probably deprecated and not widely used in FreeCAD. See comment in Material.py module.
Traceback (most recent call last):
  File "/home/tkcook/.FreeCAD/Mod/CfdOF/CfdFluidMaterial.py", line 174, in setEdit
    taskd = _TaskPanelCfdFluidProperties.TaskPanelCfdFluidProperties(self.Object, physics_model)
  File "/home/tkcook/.FreeCAD/Mod/CfdOF/_TaskPanelCfdFluidProperties.py", line 62, in __init__
    self.import_materials()
  File "/home/tkcook/.FreeCAD/Mod/CfdOF/_TaskPanelCfdFluidProperties.py", line 140, in import_materials
    self.add_mat_dir(system_mat_dir, ":/icons/freecad.svg")
  File "/home/tkcook/.FreeCAD/Mod/CfdOF/_TaskPanelCfdFluidProperties.py", line 123, in add_mat_dir
    self.materials[a_path] = Material.importFCMat(a_path)
  File "/home/tkcook/git/free-cad-build/Mod/Material/Material.py", line 73, in importFCMat
    Config.read(fileName, encoding='utf-8')  # respect unicode filenames
<type 'exceptions.TypeError'>: read() got an unexpected keyword argument 'encoding'
This is a build from git master a couple of days ago. Full version information:

Code: Select all

OS: Ubuntu 18.04.2 LTS (GNOME/gnome-xorg)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.17178 (Git)
Build type: Debug
Branch: master
Hash: 3132dfbf542ff54af4a6e688422373690d4c57f8
Python version: 2.7.15rc1
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedKingdom (en_GB)
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Unicode filenames in the Materials module

Post by bernd »

git commit 75b52c8 is a much better way to show a commit to others. There is a button in the forum software.
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Unicode filenames in the Materials module

Post by bernd »

git commit 6a8f6e2


BTW: all other modules of FreeCAD use the other material files exporter and importer.

Code: Select all

This mat card reader is probably deprecated and not widely used in FreeCAD. See comment in Material.py module.
tomkcook
Posts: 87
Joined: Wed Jul 20, 2016 3:39 pm

Re: Unicode filenames in the Materials module

Post by tomkcook »

Thanks.
Post Reply