ArcMap 10/10.1 FeatureSet saving python tool causes complete crash

1497
1
11-15-2012 01:31 AM
SzymonPiskula
New Contributor
Hi,

Recently I came across a situation when I tried to save an empty FeatureSet to a featureclass using the FeatureSet.save() method.
I realize that if the featureset object is not initialized or not populated saving process does not have to go correctly but completely crashing entire application is a bit too much I think. I would definitely expect any errors to be caught by the 'try-except' block.

In the attachment there is a set of files that should allow reproducing the behaviour. Unpack it to 'C:\Projects\bugtest'. Open 'C:\Projects\bugtest\tests.mxd'. In ArcMap go to 'Catalog' window and open 'Toolbox.tbx' from the home directory.

In the toolbox there are two python based tools. Both consume the same python script called 'rs2fc.py'. The difference between them is that:
-fc2fc tool as input takes optional feature class parameter
-rs2fc tool as input takes optional feature set parameter

Executing fc2fc without any input causes errors but the errors are caught by 'tr-except' block which is as expected
Executing rs2fc without any input causes complete crash of ArcMap. No error is intercepted by 'tr-except' block.

In the attachments there are screen shots of the crash and data to reproduce it.

Thanks,
Szymon
0 Kudos
1 Reply
DavidWynne
Esri Contributor
Definitely should not crash.  Populating the parameter, as you noted, will help here, as will setting a schema for the parameter.

As an alternative to using .save could also just use CopyFeatures_management, which will fail for this case, but that can be then trapped for.   Could also use GetParameterAsText (instead of GetParameter) to get the parameter's value.

-Dave
0 Kudos