View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0001054 | FreeCAD | Feature | public | 2013-03-14 11:42 | 2015-01-10 15:49 |
Reporter | crashfridh | Assigned To | wmayer | ||
Priority | normal | Severity | feature | Reproducibility | N/A |
Status | closed | Resolution | fixed | ||
Summary | 0001054: Show name of feature when it reports a warning | ||||
Description | Consider 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. | ||||
Tags | No tags attached. | ||||
FreeCAD Information | |||||
|
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? |
|
Yes, that is exactly what I mean. Property name and perhaps also obj.Name |
|
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? |
|
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. |
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 |