Looks like you need to escape the " with a '\'mfraz74 wrote: ↑Tue Oct 04, 2022 4:50 pm Just tried to use a quotation mark in the Draft WB's Shape from text tool and get the error:
1.12302 <asm3.main> init_gui.py(14): no solver backend found
Code: Select all
Traceback (most recent call last): File "/tmp/.mount_FreeCAdOZlpR/usr/Mod/Draft/drafttaskpanels/task_shapestring.py", line 216, in accept Gui.doCommand(o+".String=\"" + string + "\"") <class 'SyntaxError'>: ('unterminated string literal (detected at line 1)', ('<string>', 1, 65, 'FreeCAD.ActiveDocument.getObject("ShapeString").String="1 x 1/2""', 1, 65)) ^CTraceback (most recent call last): File "/tmp/.mount_FreeCAdOZlpR/usr/Mod/Tux/NavigationIndicatorGui.py", line 50, in changeEvent def changeEvent(self, event): KeyboardInterrupt
Code: Select all
OS: Ubuntu 22.04.1 LTS (KDE/plasma) Word size of FreeCAD: 64-bit Version: 0.21.30492 (Git) AppImage Build type: Release Branch: master Hash: b4578fb3eae842eb510a1bc055d07d369a67ce94 Python 3.10.6, Qt 5.15.4, Coin 4.0.0, Vtk 9.1.0, OCC 7.6.3 Locale: English/United Kingdom (en_GB) Installed mods: * sheetmetal 0.2.57 * Manipulator 1.4.9 * lattice2 1.0.0 * fcgear 1.0.0 * Curves 0.5.8 * Assembly4 0.11.8 * fasteners * A2plus 0.4.59d * ThreadProfile 1.84.0 * Assembly3 0.11.3 * VendorParts
Quotation marks in Shape from text
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Re: Quotation marks in Shape from text
Re: Quotation marks in Shape from text
https://github.com/FreeCAD/FreeCAD/pull/7558
Workaround for the current (and older) versions: Add the double quotes later by editing the String property in the Property editor.
Workaround for the current (and older) versions: Add the double quotes later by editing the String property in the Property editor.
Re: Quotation marks in Shape from text
Only a suggestion to avoid substitution with "escape sequences"
Code: Select all
string = """ " """
print(string)
triple quotes are used around when as example dealing with formatted text with "single quotes" and "double quote" in it.
you could use ''' or """ as terminator, Python is clever enough to detect the Start and end pattern, the problem is that """"""" (in other word a single "double quote" enclosed in "a triple double quote" separator sequence is giving error)
But this is a corner case.
Hope it helps.
Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.
Blog: https://okkmkblog.wordpress.com/
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.
Blog: https://okkmkblog.wordpress.com/
Re: Quotation marks in Shape from text
There is probably another corner case: a triple double quote might occur in the string. AFIACT escaping the double quotes does not have similar corner cases.