Hello,
When using this function:
arcpy.da.FeatureClassToNumPyArray(featureClass, "*")
With an asterisk in the second parameter I get this error in Pyscripter:
TypeError: long() argument must be a string or a number, not 'NoneType'
While when I put the name of a field or a some fields I have no problem.
According to ESRI help, this parameter can be populated with:
A list (or tuple) of field names. For a single field, you can use a string instead of a list of strings.
Or use an asterisk (
*
) instead of a list of fields if you want to access all fields from the input table.
What am I doing wrong?
Thanks
You mention passing a field or some fields, what if you pass all fields like
jamesfreddyc
suggests?
The error suggests that a NULL in the data (which is returned as NoneType) is failing to be coerced into a Long data type. In order to troubleshoot anymore, the field that contains the problematic data needs to be isolated.
Does your feature class contain any NULL or empty geometries?
As a suggestion, when you are using parameters, read their case requirements explicitly
in your case
FeatureClassToNumPyArray (in_table, field_names, {where_clause}, {spatial_reference}, {explode_to_points}, {skip_nulls}, {null_value}).
The keyword arguments (**kwargs) already has a default. It has been my experience also, that if a kwarg has a default, don't specify it. The default should really be an empty list/tuple and not a string, which it does. You would have obtained all the fields if you had left out your second parameter altogether OR specified all the field names within a tuple as James showed you how to do.