AnsweredAssumed Answered

Why do these two lines of python code fail when I can run them separately with success?

Question asked by arildj78 on Dec 18, 2016
Latest reply on Dec 18, 2016 by Dan_Patterson

When I write these two lines in ArcGIS Pro v1.3.1 Python window I get the result shown below the dotted line. However if I run them one at a time I get the anticipated result. What is going on? By the way, the lines are part of a bigger project, and it seems like anything inserted in line 2 yields an error. I don't suspect that the GPX file is corrupted since it runs with success in example 2 below. It also runs with success with the GPXtoFeatures tool in ArcGIS.

 

 

arcpy.GPXtoFeatures_conversion("D:\Downloads\TrackLog2.gpx", "in_memory/GPX")
print("HelloWorld")
-----------------------------------------------------------------------------
Runtime error
Traceback (most recent call last):
File "<string>", line 2, in <module>
AttributeError: 'NoneType' object has no attribute 'write'

.

 

arcpy.GPXtoFeatures_conversion("D:\Downloads\TrackLog2.gpx", "in_memory/GPX")
-----------------------------------------------------------------------------
<Result 'D:\\ArcGIS Projects\\Test\\Test.gdb\\GPX29'>

 

 

print("HelloWorld")
-----------------------------------------------------------------------------
HelloWorld

Attachments

Outcomes