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
try raw formatting your inputs if you are using command line... ie r"your path goes here preferably without spaces"
having paths beginning with 'n', 't' etc raises the possibility of the \n sequence (for example) being treated as an escape character (in this case a new line)
Same result Is this a bug in ArcGIS Pro? The code runs in ArcGIS Desktop 10.4. Can anyone try to reproduce the error?
arcpy.GPXtoFeatures_conversion(r"D:\Downloads\TrackLog2.gpx", r"in_memory/GPX")
print(r"HelloWorld")
--------------------------------------------------------------------------------------------------
Runtime error
Traceback (most recent call last):
File "<string>", line 2, in <module>
AttributeError: 'NoneType' object has no attribute 'write'
arcpy was imported I assume? like in the example GPX To Features—Conversion toolbox | ArcGIS for Desktop
No it was not. However, I have now tried with it imported and it gives the same result. However, if I was missing a reference, I shouldn't have had any luck when I run the example on line at a time...
well the only thing I can test is the 2nd line... which works.
Check for the existence of the file which I presume it is there since the first incarnation works.
Which leaves The in_memory workspace—ArcGIS Pro | ArcGIS for Desktop looks ok on the surface, but there are a whole load of errors associated with it and stuff in PRO Search Result | ArcGIS Desktop
so that leaves... trying to save it elsewhere.