Esri / arcgis-osm-editor

ArcGIS Editor for OpenStreetMap is a toolset for GIS users to access and contribute to OpenStreetMap through their Desktop or Server environment.
Apache License 2.0
395 stars 129 forks source link

TypeError: OSMGPFileLoader() takes 0 positional arguments but 7 were given #197

Closed neogeomat closed 5 years ago

neogeomat commented 5 years ago

I exported a working model to python and i am trying to run it from arcpy. I have imported the toolbox.

This line arcpy.OSMGPFileLoader_osmtools(interpreter_osm, "CONSERVE_MEMORY", "", overpass, overpass_osm_pt, overpass_osm_ln, overpass_osm_ply) gives Traceback (most recent call last): File "D:\neogeomat\Documents\ArcGIS\Projects\Eliza\elizapasaexport.py", line 33, in <module> arcpy.OSMGPFileLoader_osmtools(interpreter_osm, "CONSERVE_MEMORY", "", overpass, overpass_osm_pt, overpass_osm_ln, overpass_osm_ply) TypeError: OSMGPFileLoader() takes 0 positional arguments but 7 were given

Removing arguments arcpy.OSMGPFileLoader_osmtools() gives Traceback (most recent call last): File "<pyshell#0>", line 1, in <module> arcpy.OSMGPFileLoader_osmtools() File "c:\Program Files (x86)\arcgis\desktop10.6\ArcToolbox\Toolboxes\OpenStreetMap Toolbox.tbx", line 173, in OSMGPFileLoader

ThomasEmge commented 5 years ago

I think the error message might be misleading at this point. The max is 6 arguments and you are providing 7.

This is from the tool help:

# load the stand-alone OSM file and store it in the target feature dataset
arcpy.OSMGPFileLoader_osmtools(r'c:\temp\map.osm', 'CONSERVE_MEMORY', nameOfTargetDataset, nameOfPointFeatureClass, nameOfLineFeatureClass, nameOfPolygonFeatureClass)
neogeomat commented 5 years ago

@ThomasEmge Modifying the code to 6 arguments also gives a similar error. arcpy.OSMGPFileLoader_osmtools(interpreter_osm, "CONSERVE_MEMORY", overpass, overpass_osm_pt, overpass_osm_ln, overpass_osm_ply) gives TypeError: OSMGPFileLoader() takes 0 positional arguments but 6 were given

xeir83 commented 5 years ago

Try defining the invariables, i made mine like this; arcpy.OSMGPFileLoader_osmtools(in_osmFile=in_osmFile, in_conserveMemory="CONSERVE_MEMORY",
in_attributeselect="", out_targetdataset=targetdataset, out_osmPoints=out_osmPoints, out_osmLines=out_osmLines, out_osmPolygons = out_osmPolygons)

xeir83 commented 5 years ago

I just faced the same issue when trying my script on a lower version (at my server) of the OSM toolbox. My script works just fine on the toolbox for 10.6, but when executed for the toolbox in 10.2 i got the same error as you. Will try upgrading the toolbox to 10.3 in the next week to see if the problem persists.

ThomasEmge commented 5 years ago

If the problem still exists, please reopen.