Ticket #534 (new Defect: null)

Opened 14 months ago

With ArcGIS 10, calling GeoEco tools from a Python geoprocessing script fails with SyntaxError: EOL while scanning string literal

Reported by: jjr8 Owned by: jjr8
Priority: High Milestone: 0.8
Component: Core - ArcGIS Interop Version:
Keywords: Cc:

Description

The way it is supposed to work is that you need to call arcpy.ImportToolbox on the MGET toolbox before calling the functions. Unfortunately that is currently broken:

>>> import arcpy
>>> arcpy.ImportToolbox(r'C:\Program Files\GeoEco\ArcGISToolbox\Marine Geospatial Ecology Tools.tbx', 'GeoEco')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Program Files (x86)\ArcGIS\Desktop10.0\arcpy\arcpy\__init__.py", line 94, in ImportToolbox
    return import_toolbox(input_file, module_name)
  File "C:\Program Files (x86)\ArcGIS\Desktop10.0\arcpy\arcpy\toolbox_code.py", line 411, in import_toolbox
    mymodule = generate_toolbox_module(toolbox, None, False, False, False, module_name)
  File "C:\Program Files (x86)\ArcGIS\Desktop10.0\arcpy\arcpy\toolbox_code.py", line 389, in generate_toolbox_module
    mycode = compile(code.encode('utf-8'), toolbox.pathName, 'exec')
  File "C:\Program Files\GeoEco\ArcGISToolbox\Marine Geospatial Ecology Tools.tbx", line 34442
    very small discrepancies compared with the navigation-corrected version.""""
                                                                               ^
SyntaxError: EOL while scanning string literal
>>>

I’m not sure what the problem is. I have been testing MGET with Python but I have been using the 9.x style of geoprocessing. This still works with Arc 10:

>>> import arcgisscripting
>>> gp = arcgisscripting.create(10.0)
>>> gp.AddToolbox(r'C:\Program Files\GeoEco\ArcGISToolbox\Marine Geospatial Ecology Tools.tbx')
>>> gp.ArcGISLinesFromVectorComponentRasters_GeoEco(r'C:\Temp\u_Layer1.img', r'C:\Temp\v_Layer1.img', r'C:\Temp\test_vectors4.shp', 0.2)
Creating lines in C:\Temp\test_vectors4.shp from vector component rasters C:\Temp\u_Layer1.img and C:\Temp\v_Layer1.img.
<geoprocessing server result object object at 0x13CFD890>
>>>

As far as I have been able to tell, it is generally safe to use both import arcgisscripting and import arcpy from the same Python program. arcpy itself is a pure Python module that wraps arcgisscripting.

Note: See TracTickets for help on using tickets.