Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CAM: 'ascii' codec can't encode character u'\...' #18698

Open
2 tasks done
Doriangaensslen opened this issue Dec 23, 2024 · 10 comments
Open
2 tasks done

CAM: 'ascii' codec can't encode character u'\...' #18698

Doriangaensslen opened this issue Dec 23, 2024 · 10 comments
Labels
Mod: CAM Related to the CAM/Path Workbench OS: macOS Status: Needs confirmation Missing confirmation from other testers Status: Needs test on dev version Missing test on the weekly version

Comments

@Doriangaensslen
Copy link

Doriangaensslen commented Dec 23, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Problem description

I've stumbled upon a new bug on iOS macOS today

Reproduce:

  1. Create a CAM job
  2. Create a Tool that has special Characters (Example: see screenshot with a
    Testfile.zip
    "ä" in its name)
  3. choose GRBL as processor
  4. chose an action, where the tool with the special character is used (in the Screenshot) Pocket_Shape).
  5. Click "Post Process"

image

I guess the following error with "xe4" is ISO-8859-1 (european languages), in which case it's "ä"

18:48:10  PostProcessor:  script_module postprocessing...
18:48:12  done postprocessing.
18:48:18  Running the Python command 'CAM_Post' failed:
Traceback (most recent call last):
  File "/Applications/FreeCAD.app/Contents/Resources/Mod/CAM/Path/Post/Command.py", line 207, in Activated
    self._write_file(fname, gcode, policy)
  File "/Applications/FreeCAD.app/Contents/Resources/Mod/CAM/Path/Post/Command.py", line 135, in _write_file
    f.write(gcode)

'ascii' codec can't encode character '\xe4' in position 275: ordinal not in range(128)

Full version info

OS: macOS 15.0.1
Architecture: arm64
Version: 1.0.0.39109 (Git) Conda
Build type: Release
Branch: (HEAD detached at 1.0.0)
Hash: 2fcc5317fe3aee96ca73475986a577719fc78e20
Python 3.11.10, Qt 5.15.15, Coin 4.0.3, Vtk 9.3.0, OCC 7.8.1
Locale: C/Default (C)
Stylesheet/Theme/QtStyle: FreeCAD Dark.qss/FreeCAD Dark/Fusion
Installed mods: 
  * btl 0.9.9

Subproject(s) affected?

CAM

Anything else?

I found a very old Problem, which led me to the solution:
https://forum.freecad.org/viewtopic.php?style=3&p=799146#p799146

Code of Conduct

  • I agree to follow this project's Code of Conduct
@Doriangaensslen Doriangaensslen added Status: Needs confirmation Missing confirmation from other testers Status: Needs triage Missing triage labels Dec 23, 2024
@Doriangaensslen
Copy link
Author

I tested with another File and another Tool which had also "ä" in its name on Freecad 1.0 on my PopOs, but this seems to work. So i think its just MacOS and Windows related.

@luzpaz luzpaz changed the title 'ascii' codec can't encode character u'\...' CAM: 'ascii' codec can't encode character u'\...' Dec 23, 2024
@luzpaz
Copy link
Contributor

luzpaz commented Dec 23, 2024

I've Stumbled upon a new bug on iOS today

I believe you meant macOS here

@luzpaz
Copy link
Contributor

luzpaz commented Dec 23, 2024

Any chance you can test on Weekly ? (https://github.com/FreeCAD/FreeCAD-Bundle/releases/tag/weekly-builds)

@luzpaz luzpaz added Status: Needs test on dev version Missing test on the weekly version Mod: CAM Related to the CAM/Path Workbench labels Dec 23, 2024
@Doriangaensslen
Copy link
Author

Doriangaensslen commented Dec 24, 2024

I've Stumbled upon a new bug on iOS today

I believe you meant macOS here

Yes absolutetly true.

Any chance you can test on Weekly ? (https://github.com/FreeCAD/FreeCAD-Bundle/releases/tag/weekly-builds)

I tried that build two times, and could not install ("FreeCAD.app" is damaged and can't be opened. You should move it to the Trash.). However, i had no problem with reinstalling the 1.0 Release.

@Doriangaensslen
Copy link
Author

Somehow, the Fix posted here: https://forum.freecad.org/viewtopic.php?p=799303#p799303 did not work for me.

@luzpaz
Copy link
Contributor

luzpaz commented Dec 24, 2024

"FreeCAD.app" is damaged and can't be opened.

What version did you try to install? Did you just run in to the code-signing issue where you need to employ the right click context menu to open it ? Or is the weekly macOS build broken ?

@JohnOCFII
Copy link

"FreeCAD.app" is damaged and can't be opened.

What version did you try to install? Did you just run in to the code-signing issue where you need to employ the right click context menu to open it ? Or is the weekly macOS build broken ?

@Doriangaensslen

On macOS arm machines, there is a separate installation issue. Until the new installation setup is resolved, to test the weekly builds, the user needs to open a Terminal window and execute the following command:

sudo xattr -r -d com.apple.quarantine /Applications/FreeCAD.app

@maxwxyz maxwxyz added OS: macOS and removed Status: Needs triage Missing triage labels Dec 25, 2024
@Doriangaensslen
Copy link
Author

sudo xattr -r -d com.apple.quarantine /Applications/FreeCAD.app

Thanks, i was able to open the weekly build FreeCAD_weekly-builds-39747-conda-macOS-arm64-py311.dmg

But sadly, the issue still persists if il add a tool with special characters.

@Syres916
Copy link
Contributor

Syres916 commented Jan 1, 2025

@Doriangaensslen could you please modify your local copy of src/Mod/CAM/Path/Post/Command.py as per main...Syres916:FreeCAD:CAM_Fix_Post_Write_File_Using_Codecs
If it works as I believe it should, I can see if an additional test can be made for non-ascii characters, I've done the same for Techdraw in the last few days.

@Doriangaensslen
Copy link
Author

I can confirm, that this fixes this specific issue! Good work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Mod: CAM Related to the CAM/Path Workbench OS: macOS Status: Needs confirmation Missing confirmation from other testers Status: Needs test on dev version Missing test on the weekly version
Projects
None yet
Development

No branches or pull requests

5 participants