[solved] Type.Error - Sketching is impossible
Forum rules
and Helpful information
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!
Also, be nice to others! Read the FreeCAD code of conduct!
[solved] Type.Error - Sketching is impossible
Bug-Ticket: https://freecadweb.org/tracker/view.php?id=2891#c8233
OS: Debian GNU/Linux 9.0 (stretch)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.16.
Build type: None
Python version: 2.7.13
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
Kernel: Linux 4.9.2-2-amd64
Installed via: apt-get install freecad
short description:
If i click on "Create a new sketch", i receive everytime the following error message:
Traceback (most recent call last):
File "<string>", line 1, in <module>
<type 'exceptions.TypeError'>: Either three floats, tuple or Vector expected
and i can't create anything in the sketcher. For example, if i wan't to draw a line it put's the error message:
Failed to add line: Either three floats, tuple or Vector expected
Failed to add line: ('invalid token', ('<string>', 1, 99, 'App.ActiveDocument.Sketch.addGeometry(Part.Line(App.Vector(0,000000,0,000000,0),App.Vector(2,003810,1,106270,0)),False)\n'))
or the error message if i wan't to draw a circle:
Failed to add circle: Either three floats, tuple or Vector expected
Steps To Reproduce
1) Start FreeCAD
2) Start Sketcher
3) Click on "Create new sketch" <---the "typeError"-Exception appears
4) Click on "Line" or "Circle"
5) Draw a "Line" or "Circle" <---the "Failed to add"-Error message appears
OS: Debian GNU/Linux 9.0 (stretch)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.16.
Build type: None
Python version: 2.7.13
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
Kernel: Linux 4.9.2-2-amd64
Installed via: apt-get install freecad
short description:
If i click on "Create a new sketch", i receive everytime the following error message:
Traceback (most recent call last):
File "<string>", line 1, in <module>
<type 'exceptions.TypeError'>: Either three floats, tuple or Vector expected
and i can't create anything in the sketcher. For example, if i wan't to draw a line it put's the error message:
Failed to add line: Either three floats, tuple or Vector expected
Failed to add line: ('invalid token', ('<string>', 1, 99, 'App.ActiveDocument.Sketch.addGeometry(Part.Line(App.Vector(0,000000,0,000000,0),App.Vector(2,003810,1,106270,0)),False)\n'))
or the error message if i wan't to draw a circle:
Failed to add circle: Either three floats, tuple or Vector expected
Steps To Reproduce
1) Start FreeCAD
2) Start Sketcher
3) Click on "Create new sketch" <---the "typeError"-Exception appears
4) Click on "Line" or "Circle"
5) Draw a "Line" or "Circle" <---the "Failed to add"-Error message appears
Last edited by RM. on Wed Feb 08, 2017 11:56 pm, edited 1 time in total.
Re: [bug] Type.Error - Sketching is impossible
From which repository do you install?
Please try deleting your config files, i.e. the directory ~/.FreeCAD.
Please try deleting your config files, i.e. the directory ~/.FreeCAD.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: [bug] Type.Error - Sketching is impossible
1) my repository configuration is:
2) same error, if i delete both config file
Code: Select all
#/etc/apt/sources.list
deb http://ftp.de.debian.org/debian/ testing main contrib non-free
deb-src http://ftp.de.debian.org/debian/ testing main contrib non-free
Code: Select all
.FreeCAD/system.cfg
.FreeCAD/user.cfg
Re: [bug] Type.Error - Sketching is impossible
solved.
It was the locale problem (point vs. comma)
workaround-script, to start freeCAD:
It was the locale problem (point vs. comma)
workaround-script, to start freeCAD:
Code: Select all
#!/bin/bash
export LC_ALL=C
freecad $1 $2 $3 $4 $5
Re: [solved] Type.Error - Sketching is impossible
wmayer,
My system's decimal separator is a comma as well. How come I've never had this issue?
OS: Ubuntu 14.04.5 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.16.6707 (Git)
Build type: None
Branch: releases/FreeCAD-0-16
Hash: 5465bc47c95db45e0be85dc0e2872419efadce0f
Python version: 2.7.6
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
EDIT:
My system's decimal separator is a comma as well. How come I've never had this issue?
OS: Ubuntu 14.04.5 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.16.6707 (Git)
Build type: None
Branch: releases/FreeCAD-0-16
Hash: 5465bc47c95db45e0be85dc0e2872419efadce0f
Python version: 2.7.6
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
EDIT:
Code: Select all
$ locale
LANG=fr_CA.UTF-8
LANGUAGE=fr_CA:fr
LC_CTYPE="fr_CA.UTF-8"
LC_NUMERIC="fr_CA.UTF-8"
LC_TIME="fr_CA.UTF-8"
LC_COLLATE="fr_CA.UTF-8"
LC_MONETARY="fr_CA.UTF-8"
LC_MESSAGES="fr_CA.UTF-8"
LC_PAPER="fr_CA.UTF-8"
LC_NAME="fr_CA.UTF-8"
LC_ADDRESS="fr_CA.UTF-8"
LC_TELEPHONE="fr_CA.UTF-8"
LC_MEASUREMENT="fr_CA.UTF-8"
LC_IDENTIFICATION="fr_CA.UTF-8"
LC_ALL=
Re: [solved] Type.Error - Sketching is impossible
Here it's said thatMy system's decimal separator is a comma as well. How come I've never had this issue?
Now on Ubuntu systems LC_ALL is not set so that LC_NUMERIC and others take effect. To make sure that for C functions used inside FreeCAD the right locale is used we set at the beginning of the main() function LC_NUMERIC to "C".LC_ALL
This variable determines the values for all locale categories. The value of the LC_ALL environment variable has precedence over any of the other environment variables starting with LC_ (LC_COLLATE, LC_CTYPE, LC_MESSAGES, LC_MONETARY, LC_NUMERIC, LC_TIME) and the LANG environment variable.
On Debian systems it seems that LC_ALL is set so that our change LC_NUMERIC=C alone is useless.
In v0.17, however, we don't get the point vs. comma problem at all and I assume it's due to the change git commit 3c269f4cc.
Re: [solved] Type.Error - Sketching is impossible
I stumbled across this interesting comment of the Qt documentation which proves that Qt is causing all the trouble.
QCoreApplication internally calls setlocale(LC_ALL,"") which causes to take effect the system settings and that's why the call of LC_NUMERIC=C in the main() function (which is called long before QCoreApplication) is useless when the system environment variable LC_ALL is set (and defines a language using a comma as decimal separator).
(FYI, this applies to all previous Qt versions, too -- not just Qt5.)On Unix/Linux Qt is configured to use the system locale settings by default. This can cause a conflict when using POSIX functions, for instance, when converting between data types such as floats and strings, since the notation may differ between locales. To get around this problem, call the POSIX function setlocale(LC_NUMERIC,"C") right after initializing QApplication, QGuiApplication or QCoreApplication to reset the locale that is used for number formatting to "C"-locale.
QCoreApplication internally calls setlocale(LC_ALL,"") which causes to take effect the system settings and that's why the call of LC_NUMERIC=C in the main() function (which is called long before QCoreApplication) is useless when the system environment variable LC_ALL is set (and defines a language using a comma as decimal separator).
Re: [solved] Type.Error - Sketching is impossible
Scorewmayer wrote:I stumbled across this interesting comment of the Qt documentation which proves that Qt is causing all the trouble.(FYI, this applies to all previous Qt versions, too -- not just Qt5.)On Unix/Linux Qt is configured to use the system locale settings by default. This can cause a conflict when using POSIX functions, for instance, when converting between data types such as floats and strings, since the notation may differ between locales. To get around this problem, call the POSIX function setlocale(LC_NUMERIC,"C") right after initializing QApplication, QGuiApplication or QCoreApplication to reset the locale that is used for number formatting to "C"-locale.
QCoreApplication internally calls setlocale(LC_ALL,"") which causes to take effect the system settings and that's why the call of LC_NUMERIC=C in the main() function (which is called long before QCoreApplication) is useless when the system environment variable LC_ALL is set (and defines a language using a comma as decimal separator).
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Re: [solved] Type.Error - Sketching is impossible
At least my Debian did not set LC_ALL. But it could be, that it is different with other configurations.wmayer wrote:On Debian systems it seems that LC_ALL is set so that our change LC_NUMERIC=C alone is useless.
But now commit http://github.com/FreeCAD/FreeCAD/commit/6c2a7b4 causes a problem with FEM, see here: https://forum.freecadweb.org/viewtopic.php?f=18&t=20600
How can I check, if the new conditional code was compiled?
Ulrich