Is this stilll correct?: Don't use special characters in your windows user name

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
User avatar
chennes
Veteran
Posts: 3881
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Is this stilll correct?: Don't use special characters in your windows user name

Post by chennes »

Haavard wrote: Tue Jun 28, 2022 4:20 pm Non-working username:

Code: Select all

HåvardJakobsen
Can you tell me whether, after attempting the installation, the directory "C:\Users\HåvardJakobsen\AppData\Roaming\FreeCAD\Mod\Assembly4" exists? I'm trying to figure out whether the problem is in the unzip code or the metadata code.
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Is this stilll correct?: Don't use special characters in your windows user name

Post by wmayer »

chrisb wrote: Tue Jun 28, 2022 9:19 pm Added it to the Windows section. How about the other OSs?
This is a Windows-only problem because a UTF-8 encoded file path is not encoded as UTF-16 (wide string) when passing it to boost::file_system::path.

It can be easily tested without creating an account with special characters. Just create the directory C:\Temp\HåvardJakobsen and put a valid package.xml into it. Now run this Python code:

Code: Select all

App.Metadata(r"C:\Temp\HåvardJakobsen\package.xml")
It will raise the error:
Traceback (most recent call last):
File "<input>", line 1, in <module>
Base.XMLBaseException: Fatal error at file "", line 0, column 0
Message: unable to open primary document entity 'C:\Temp\HåvardJakobsen\package.xml
Haavard
Posts: 217
Joined: Wed Feb 17, 2021 10:48 pm

Re: Is this stilll correct?: Don't use special characters in your windows user name

Post by Haavard »

chennes wrote: Tue Jun 28, 2022 10:48 pm Can you tell me whether, after attempting the installation, the directory "C:\Users\HåvardJakobsen\AppData\Roaming\FreeCAD\Mod\Assembly4" exists? I'm trying to figure out whether the problem is in the unzip code or the metadata code.
I deleted all AppData folders and this is the result:
After opening and closing fc the default FreeCAD folder is created as expected:
1.png
1.png (34.41 KiB) Viewed 997 times

After pressing install on Assy4, the Mod\Assembly4 folder is created, so the unzip parts should work correctly. I compared the sha256 of all files in this folder to the git archive, and it matches.
2.png
2.png (169.47 KiB) Viewed 997 times
3.png
3.png (67.54 KiB) Viewed 997 times
4.png
4.png (30.43 KiB) Viewed 997 times
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Is this stilll correct?: Don't use special characters in your windows user name

Post by wmayer »

git commit 22829f8a24 fixes the utf-8 / utf-16 conversion of the file path so that Metadata can load the XML file. It still needs to be tested if this also fixes all issues with the AddonManager if the user name includes special characters.

EDIT: I have added the commit to the list of backports: https://forum.freecadweb.org/viewtopic. ... 06#p602206
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Is this stilll correct?: Don't use special characters in your windows user name

Post by wmayer »

I have added a unit test to check file paths (git commit 448b1ec9f38077). After fixing the actual issue with MetadataPy the unit tests pass on my local machines (Windows/Linux) but for some reason the CI tests on Gitlab fail. The error is:

Code: Select all

Traceback (most recent call last):
  File "/builds/freecad/FreeCAD-CI/build/Mod/Test/Metadata.py", line 114, in test_file_path
    xmlfile = open(file=filename, mode="w", encoding="utf-8")
UnicodeEncodeError: 'ascii' codec can't encode character '\xe5' in position 6: ordinal not in range(128)
Neither setting the encoding to utf-8 nor using the codecs module to open the file works.


Anyone has an idea why this happens and how to fix it? I thought with Py3 all this kind of issues should have gone.
mario52
Veteran
Posts: 4673
Joined: Wed May 16, 2012 2:13 pm

Re: Is this stilll correct?: Don't use special characters in your windows user name

Post by mario52 »

Hi

over 127 my "cauchemar"

App.Metadata(r"C:\\Temp\\HåvardJakobsen\\package.xml")

Code: Select all

>>> App.Metadata(r"C:\\Temp\\HåvardJakobsen\\package.xml")
Traceback (most recent call last):
  File "<input>", line 1, in <module>
Base.XMLBaseException: Fatal error at file "", line 0, column 0
   Message: unable to open primary document entity 'C:\\Temp\\HåvardJakobsen\\package.xml'
App.Metadata(r"C:\\Temp\\HavardJakobsen\\package.xml")

Code: Select all

>>> App.Metadata(r"C:\\Temp\\HavardJakobsen\\package.xml")
Traceback (most recent call last):
  File "<input>", line 1, in <module>
Base.XMLBaseException: package.xml format version is not supported by this version of FreeCAD
>>>
the content .xml (good or not good ? if not good give one good .xml file)

Code: Select all

<?xml version="1.0" encoding="utf-8" standalone="no" ?>
<package format="2" xmlns="https://wiki.freecad.org/Package_Metadata">
	<name>Bad format</name>
	<description>There is no such thing as format version 2 (yet).</description>
	<version>1.0.0</version>
</package>
FC info

Code: Select all

OS: Windows 10 (10.0)
Word size of FreeCAD: 64-bit
Version: 0.21.29283 (Git)
Build type: Release
Branch: master
Hash: 15e3e86c5a683f3b2e5c7b95d4b26cd719ab367a
Python 3.8.13, Qt 5.12.9, Coin 4.0.0, Vtk 9.1.0, OCC 7.5.3

mario
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Topological_data_scripting.
My macros on Gist.github here complete macros Wiki and forum.
User avatar
chennes
Veteran
Posts: 3881
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Is this stilll correct?: Don't use special characters in your windows user name

Post by chennes »

That XML file is one of my "bad" example files from the test suite -- you are getting the correct error for it when you use the plain ASCII username. Is that with @wmayer's latest code, or an earlier version?
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
mario52
Veteran
Posts: 4673
Joined: Wed May 16, 2012 2:13 pm

Re: Is this stilll correct?: Don't use special characters in your windows user name

Post by mario52 »

Hi

.xml same content

version FC for the 2 tests

Code: Select all

OS: Windows 10 (10.0)
Word size of FreeCAD: 64-bit
Version: 0.21.29283 (Git)
Build type: Release
Branch: master
Hash: 15e3e86c5a683f3b2e5c7b95d4b26cd719ab367a
Python 3.8.13, Qt 5.12.9, Coin 4.0.0, Vtk 9.1.0, OCC 7.5.3
mario
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Topological_data_scripting.
My macros on Gist.github here complete macros Wiki and forum.
faustino
Posts: 1
Joined: Tue Jul 05, 2022 9:50 pm

Re: Is this stilll correct?: Don't use special characters in your windows user name

Post by faustino »

Hi
I have the same problem with my username - António- in my instalation of Assembly4 it was installed in C:\Users\António\AppData\Roaming\FreeCAD\Mod\Assembly4 it changed ó with ó.

I have another problem but don't know if they're related, when i try to do a dimensional constraint using the formula editor with <<movel1>>#<<Spreadsheet>>.grossuraazulejo it gives an error
---------------------------
Dimensional constraint
---------------------------
Failed to convert to Quantity
in property binding 'lateral_direita#Sketch001.Constraints'
---------------------------
OK
-------------------------
My FC

Code: Select all

OS: Windows 10 Version 2009
Word size of FreeCAD: 64-bit
Version: 0.20.29177 (Git)
Build type: Release
Branch: releases/FreeCAD-0-20
Hash: 68e337670e227889217652ddac593c93b5e8dc94
Python 3.8.10, Qt 5.15.2, Coin 4.0.1, Vtk 8.2.0, OCC 7.6.2
Locale: Portuguese/Portugal (pt_PT)
Installed mods: 
  * Assembly4 0.12.0
openBrain
Veteran
Posts: 9034
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: Is this stilll correct?: Don't use special characters in your windows user name

Post by openBrain »

faustino wrote: Tue Jul 05, 2022 10:06 pm I have another problem but don't know if they're related, when i try to do a dimensional constraint using the formula editor with <<movel1>>#<<Spreadsheet>>.grossuraazulejo it gives an error
This is very unlikely to be related. Please open a new topic in the 'Help' subforum and attach your file there. ;)
Post Reply