Python Script Errors (Upgrading Arcmap from 10.1 to 10.3)

2668
9
04-14-2016 06:54 AM
JawadhHabeeb1
Occasional Contributor

Hello,

I have a custom made  python Toolbox which worked perfectly in 10.2, it has stopped working now when I started using it in 10.3.

I get the following Errors..

Traceback (most recent call last):

File "<string>", line 56, in execute

File "<string>", line 32, in RoundValue

AttributeError: '_passthrough' object has no attribute 'float'

These erros where thrown right after I started using 10.3 , but worked perfectly in 10.2  ...

Any Clue ..?

Cheers

Jawadh

Tags (3)
0 Kudos
9 Replies
DanPatterson_Retired
MVP Esteemed Contributor

The script wasn't posted, but it appears you have a problem with the _passthrough object doesn't have a float property.

You can demonstrate this with any object and check its properties

>>> "a".float
Traceback (most recent call last):
  File "<interactive input>", line 1, in <module>
AttributeError: 'str' object has no attribute 'float'

So it is probably related to the toolbox its self and how you are delivering or receiving parameters

JawadhHabeeb1
Occasional Contributor

Hi Dan,

Has it got to do anything with using 10.3 Arcmap,  it worked perfectly in 10.1 ...?

i m using python version 2.7

0 Kudos
DanPatterson_Retired
MVP Esteemed Contributor

The python version is the same, so it isn't python and the toolboxes should be upward compatible (not necessarily downward).  You will have to examine the toolbox parameters and see if there was a change in how it was read in the newer version.  It would probably be quicker to rebuild a new tool script tool in a new toolbox than spend hours going through the potential bug list.  As a check, use it on a dataset that previously worked.  If it fails, then it is the toolbox or some missing script component, parameter definition or a change in some import.  If it works, then it is the data.

0 Kudos
JawadhHabeeb1
Occasional Contributor

Hello Dan,

I am posting the code in the main question, still can't figure out whats wrong with executing it .

The Zip file contains the pyt tool file and a GDB for testing out points.

Text file contains GeoJSON values.

0 Kudos
JawadhHabeeb1
Occasional Contributor

..?

0 Kudos
DanPatterson_Retired
MVP Esteemed Contributor

sorry no extended time available yet... putting out many fires... maybe put WAB in the title, it may attract some interest from others

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

I ran your toolbox, and it generated the same error, but from a completely different part of the code than what you included originally:

Messages
Executing: ExportPointHeights D:\tmp\Python_Codes\New_DataSet.gdb\Points_2 # "{"xmax":3703669.161,"ymin":3558596.729,"spatialReference":{"wkid":27039},"ymax":3529259.670,"xmin":3624802.003} " D:\tmp\Python_Codes\ex.zip
Start Time: Wed Apr 20 12:26:12 2016
Running script ExportPointHeights...
Storing geometry into Z-aware feature class
<arcpy.arcobjects.mixins._passthrough object at 0x20135A30>

Traceback (most recent call last):
  File "<string>", line 173, in execute
  File "<string>", line 148, in clipInputFC
  File "<string>", line 125, in getClipValueFromParams
AttributeError: '_passthrough' object has no attribute 'type'

Failed to execute (ExportPointHeights).
Failed at Wed Apr 20 12:26:13 2016 (Elapsed Time: 1.08 seconds)

I included the whole message above because there are usually relevant pieces of information before the actual error message.  For example, the whole message lets you know that it is an arcpy.arcobjects.mixins._passthrough object that is generating the error.  A similar error can be generated with a couple lines of code:

>>> obj = arcpy.arcobjects.mixins.GeometrySpecializationMixin._passthrough()
>>> obj
<arcpy.arcobjects.mixins._passthrough object at 0x1E403390>
>>> obj.type
Runtime error 
Traceback (most recent call last):
  File "<string>", line 1, in <module>
AttributeError: '_passthrough' object has no attribute 'type'
>>>

In ArcPy, Esri uses _passthrough objects behind the scenes to facilitate passing objects, attributes, etc... between Python and the underlying ArcGIS code.  The error message is stating you referenced an attribute (named 'type') that doesn't exist for an object that was passed through or back to your Python code from ArcGIS.  Looking at Line 125 referenced above:

arcpy.CreateFeatureclass_management(tempGDBPath, "storeFeature", clipGeom.type ,None, "SAME_AS_TEMPLATE", "ENABLED", clipGeom.spatialReference)

The error is being generated by clipGeom.type .  In all likelihood, whatever object you think is stored in clipGeom, it is something different.  I would start by investigating clipGeom and working backwards from there.

JawadhHabeeb1
Occasional Contributor

Hi Joshua,

Thanks for the reply,

The error which I posted in the main question was from a different Code, sorry to mention that. And the current code displays the same error.

thanks for the info on "_passthrough" was trying to crack it for long.

Awaiting your solution for the code.

Cheers,

Jawadh

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

Your welcome.  I am not sure when, or if, I will be able to dig any deeper.  If you take the code out of the Python toolbox and run it in an interactive Python interpreter, it might be easier to track down the primary culprit.

0 Kudos