View Issue Details

IDProjectCategoryView StatusLast Update
0001054FreeCADFeaturepublic2015-01-10 15:49
Reportercrashfridh Assigned Towmayer  
PrioritynormalSeverityfeatureReproducibilityN/A
Status closedResolutionfixed 
Summary0001054: Show name of feature when it reports a warning
DescriptionConsider for instance a property
obj.addProperty("App::PropertyLink", "ComponentFrom", "Coupling", "Component from")

When a wrong value is assigned, it prints a warning. The warning however does not show which property reports the warning, in this case ComponentFrom. It would be very helpful if this would be shown.
TagsNo tags attached.
FreeCAD Information

Activities

wmayer

2013-03-30 13:27

administrator   ~0003017

Do you mean something like this?
> obj.addProperty("App::PropertyLink", "ComponentFrom", "Coupling", "Component from")
> obj.ComponentFrom=2

> TypeError: type must be 'DocumentObject' or 'NoneType', not int

And you want to see the property name ComponentFrom in the error message?

crashfridh

2013-03-30 13:30

reporter   ~0003018

Yes, that is exactly what I mean. Property name and perhaps also obj.Name

wmayer

2013-04-04 06:40

administrator   ~0003039

But what is the advantage of having this? If you run a script and there happens an error then Python already shows you the line where the exception was raised. So, why also printing the property name?

crashfridh

2013-04-04 06:57

reporter   ~0003042

I wish that was always the case.

See for instance:

freddy@fr-laptop:~/Dropbox/dev/Sea/resources/examples$ ./load.py
FreeCAD 0.13, Libs: 0.13R2018 (Git)
FeaturePython::onChanged (MaterialSolid): 'FeaturePython' object has no attribute 'Subsystems'
FeaturePython::onChanged (MaterialSolid): 'FeaturePython' object has no attribute 'Subsystems'
FeaturePython::onChanged (MaterialSolid): 'FeaturePython' object has no attribute 'Subsystems'
FeaturePython::onChanged (MaterialSolid): 'FeaturePython' object has no attribute 'Subsystems'
FeaturePython::onChanged (MaterialSolid): 'FeaturePython' object has no attribute 'Subsystems'
FeaturePython::onChanged (Box001_Component2DPlate): 'FeaturePython' object has no attribute 'Volume'
FeaturePython::onChanged (Box001_Component2DPlate): 'NoneType' object has no attribute 'model'
FeaturePython::onChanged (Box_Component2DPlate): 'FeaturePython' object has no attribute 'Volume'
FeaturePython::onChanged (Box_Component2DPlate): 'NoneType' object has no attribute 'model'
Importing project files......
FeaturePython::onChanged (ExcitationRain): 'NoneType' object has no attribute 'amount'


'FeaturePython' object has no attribute 'Subsystems'
Okay, so MaterialSolid has no attribute Subsystems? That is correct, it doesn't. But the error/warning actually doesn't apply to MaterialSolid, but to another FeaturePython object, which is linked to by MaterialSolid.
In this case I knew which object it had to be, but often that is not the case, making it very hard to find out.

The errors with 'NoneType' are even harder to find. Apparently some reassignment has not been made, resulting in a NoneType. However, which reassignment?

If it would say with Property changed, then it simplifies the search. Right now I simply print the Property name that has changed, to help me find the problem, but this of course results in many unnecessary lines.

Related Changesets

FreeCAD: master f1e99660

2015-01-10 16:37:49

wmayer

Details Diff
+ fixes 0001054: Show name of feature when it reports a warning Affected Issues
0001054
mod - src/App/DocumentObjectPyImp.cpp Diff File

Issue History

Date Modified Username Field Change
2013-03-14 11:42 crashfridh New Issue
2013-03-30 13:27 wmayer Note Added: 0003017
2013-03-30 13:30 crashfridh Note Added: 0003018
2013-04-04 06:40 wmayer Note Added: 0003039
2013-04-04 06:57 crashfridh Note Added: 0003042
2015-01-10 15:49 wmayer Changeset attached => FreeCAD Master master f1e99660
2015-01-10 15:49 wmayer Assigned To => wmayer
2015-01-10 15:49 wmayer Status new => closed
2015-01-10 15:49 wmayer Resolution open => fixed