Failed to parse expression on opening a file

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!
JCR84J
Posts: 41
Joined: Wed Mar 14, 2018 1:25 pm

Failed to parse expression on opening a file

Postby JCR84J » Sat Apr 28, 2018 3:18 pm

Hi,

I got the message "Failed to parse expression." in the report view on opening a file. I know it's a problem between an expression in data properties and the Spreadsheet but how to know where it this problem without looking for across all the properties of the project.

Is there some tools which could help ?

Thank you in advance for answers.
Regards

OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.13515 (Git)
Build type: Release
Branch: releases/FreeCAD-0-17
Hash: e17b340949b75a226cc7d89989b0aa238ccfc75f
Python version: 2.7.14
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.2.0
Locale: French/France (fr_FR)
JCR84J
User avatar
NormandC
Posts: 18534
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Failed to parse expression on opening a file

Postby NormandC » Sat Apr 28, 2018 6:16 pm

Hi,

JCR84J wrote:
Sat Apr 28, 2018 3:18 pm
Version: 0.17.13515 (Git)
You are not using the latest version available, which is 0.17.13519. It happens to include a bug fix for Expressions, maybe it will solve your issue.

git commit f522116
JCR84J
Posts: 41
Joined: Wed Mar 14, 2018 1:25 pm

Re: Failed to parse expression on opening a file

Postby JCR84J » Sat Apr 28, 2018 7:03 pm

NormandC wrote:
Sat Apr 28, 2018 6:16 pm
You are not using the latest version available, which is 0.17.13519
Normand, this is the same with the 13519 version.

I saw that some others Spreadsheet references have disappeared (replaced by value) from several Sketches data properties and I got the same message (Exception (Sat Apr 28 21:14:57 2018): Failed to parse expression.) after reintroducing the correct Spreadsheet reference then in the Sketch constraints. At the moment, the Spreadsheet reference stay in the Sketch constraint despite of the message and even appears correctly update in the Sketch data properties.
Then I save the project and when I reopen it, I get two messages (Failed to parse expression.) but more references have disappeared again.

But if I save again, the two messages don't appear again when I reopen one time more. But all the Sketch Spreadsheet references (in mm) have disappeared (except those in degrees).
The Spreadsheet references in the Solid objects data properties are still intact and correct.


Note also, please, there is a delay between original download page and /fr one (where current stable version is still 13515).

OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.13519 (Git)
Build type: Release
Branch: releases/FreeCAD-0-17
Hash: 1a8b868018f45ea486c0023fdbfeb06febc1fb89
Python version: 2.7.14
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.2.0
Locale: French/France (fr_FR)
JCR84J
User avatar
NormandC
Posts: 18534
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Failed to parse expression on opening a file

Postby NormandC » Sat Apr 28, 2018 8:25 pm

I never use Spreadsheets, hopefully someone who does (or even its developer) will come along.

JCR84J wrote:
Sat Apr 28, 2018 7:03 pm
Note also, please, there is a delay between original download page and /fr one (where current stable version is still 13515).
Thanks for pointing it out. It is actually only the text description that is outdated. The download links are for 0.17.13519 across all languages, because they are not translatable.

Edit: I fixed the French, Spanish, Italian and German translations. In the last one I added a sentence translated with Google Translate, I hope it is not too atrocious. :D
eivindkvedalen
Posts: 602
Joined: Tue Jan 29, 2013 10:35 pm

Re: Failed to parse expression on opening a file

Postby eivindkvedalen » Sat Apr 28, 2018 10:58 pm

JCR84J wrote:
Sat Apr 28, 2018 7:03 pm
I saw that some others Spreadsheet references have disappeared (replaced by value) from several Sketches data properties and I got the same message (Exception (Sat Apr 28 21:14:57 2018): Failed to parse expression.) after reintroducing the correct Spreadsheet reference then in the Sketch constraints. At the moment, the Spreadsheet reference stay in the Sketch constraint despite of the message and even appears correctly update in the Sketch data properties.
Then I save the project and when I reopen it, I get two messages (Failed to parse expression.) but more references have disappeared again.
Any possibility to share the file?

Eivind
JCR84J
Posts: 41
Joined: Wed Mar 14, 2018 1:25 pm

Re: Failed to parse expression on opening a file

Postby JCR84J » Sun Apr 29, 2018 8:31 am

eivindkvedalen wrote:
Sat Apr 28, 2018 10:58 pm
Any possibility to share the file?
No, the file is not shared. There is no Master Spreadsheet. No complex mathematic expression in the Spreadsheet (only addition and subtraction). Only measurement data in mm (even if they been introduced in m) and degree.

The only thing I am thinking is I tried to rename the spreadsheet (which name was initially "Spreadsheet") and as the name was not changed in expressions, I returned to the originally name. But I don't think this is the reason of the present difficulty.
Note I have also a problem with the "Spreadsheet rename" posted in FR forum. But one problem after another one

The present difficulty is only with Sketches. Why I can't introduced Spreadsheet references in Sketches constraint without message in that file?
Why the Spreadsheet references in Sketches data properties which seems to be correct after have been reintroduced (of coarse with message) disappeared after to save and to reopen the project file.

There is no difficulty with Spreadsheet references in the Solid objects data properties.

Best regards
JCR84J
JCR84J
Posts: 41
Joined: Wed Mar 14, 2018 1:25 pm

Re: Failed to parse expression on opening a file

Postby JCR84J » Sun Apr 29, 2018 4:48 pm

eivindkvedalen wrote:
Sat Apr 28, 2018 10:58 pm
Any possibility to share the file?
Sorry, I didn't catch it at first.
Please now find a very simple test file joined.
1- When you will open the file, you normally get the message "Failed to parse expression."
2 - Look at the Sketch01. Open it and for the constraint with label "Longueur base", try to change the value and to introduce a reference to the Spreadsheet with label "FeuilCalc" and cell "Longueur base" alias "Long_base" (100mm). You'll get the message "Exception (Sun Apr 29 18:11:33 2018): Failed to parse expression. ".
3 - Close the Sketch and look to the Sketch01 property. it's correct instead of the message. (view joined)
4 - Save and reopen, the references of this Sketch01 have disappeared.

Note that for the Sketch02 there is no problem. What is the difference between them ?

What Does I did wrong in that Sketch01 ? Label with space?
How to find the error ? Where to search in such a case ?

I don't see anything in the dependency graph. I valid the Sketches and check geometry of the solid.

Thank you in advance for your help
Best regards
Attachments
Test Esquisse - failed to parse expression.FCStd
(7.29 KiB) Downloaded 10 times
Sketch property.jpg
Sketch property.jpg (20.33 KiB) Viewed 674 times
JCR84J
schupin
Posts: 401
Joined: Sun Jan 21, 2018 1:43 pm

Re: Failed to parse expression on opening a file

Postby schupin » Sun Apr 29, 2018 5:05 pm

Hi,

I "solved" the problem by changing the name of your constraint in sketch01 from "Longueur base" to "Longueur_base".

Like you said, the "name" with a space seems problematic.

After that, I can't help to find faster this kind of issue...
JCR84J
Posts: 41
Joined: Wed Mar 14, 2018 1:25 pm

Re: Failed to parse expression on opening a file

Postby JCR84J » Sun Apr 29, 2018 5:31 pm

schupin wrote:
Sun Apr 29, 2018 5:05 pm
I "solved" the problem by changing the name of your constraint in sketch01 from "Longueur base" to "Longueur_base".
It's true but you did it with the Rename command of the Constraint and I always tried it in the popup "Insert length" when I was changing the value.

So, to sum up, I was doing two errors:
1 - FreeCAD doesn't accept any "space" character in Sketch constraint labels,
2 - I tried to rename a Sketch constraint label in the popup "Insert length" as I was changing the reference to the Spreadsheet instead of using the Rename command.

I don't read restriction of space in Label or Name in the documentation. May be it could be interesting to insist on that particularity.

I also found that FreeCAD on Windows doesn't accept space in the directories references in Command line.

Best regards
JCR84J
eivindkvedalen
Posts: 602
Joined: Tue Jan 29, 2013 10:35 pm

Re: Failed to parse expression on opening a file

Postby eivindkvedalen » Sun Apr 29, 2018 7:06 pm

JCR84J wrote:
Sun Apr 29, 2018 5:31 pm
It's true but you did it with the Rename command of the Constraint and I always tried it in the popup "Insert length" when I was changing the value.

So, to sum up, I was doing two errors:
1 - FreeCAD doesn't accept any "space" character in Sketch constraint labels,
2 - I tried to rename a Sketch constraint label in the popup "Insert length" as I was changing the reference to the Spreadsheet instead of using the Rename command.

I don't read restriction of space in Label or Name in the documentation. May be it could be interesting to insist on that particularity.

I also found that FreeCAD on Windows doesn't accept space in the directories references in Command line.

Best regards
In my opinion this is a bug, so please register it in the tracker and reference this thread.

Eivind