Proceed to GeoCommunity Home Page


SpatialNewsGIS Data DepotGeoImaging ChannelGIS and MappingSoftwareGIS JobsGeoBids-RFPsGeoCommunity MarketplaceGIS Event Listings
HomeLoginAccountsAboutContactAdvertiseSearchFAQsForumsCartFree Newsletter

Sponsored by:


TOPICS
Today's News

Submit News

Feature Articles

Product Reviews

Education

News Affiliates

Discussions

Newsletters

Email Lists

Polls

Editor's Corner


SpatialNews Daily Newswire!
Subscribe now!

Latest Industry Headlines
SiteVision GIS Partnership With City of Roanoke VA Goes Live
Garmin® Introduces Delta™ Upland Remote Trainer with Beeper
Caliper Offers Updated Chile Data for Use with Maptitude 2013
Southampton’s Go! Rhinos Trail Mapped by Ordnance Survey
New Approach to Measuring Coral Growth Offers Valuable Tool for Reef Managers
Topo ly - Tailor-Fit for Companies' Online Mapping Needs

Latest GeoBids-RFPs
Nautical Charts*Poland
Software & Telemetry GPS
Spatial Data Management-DC
Geospatial and Mapping-DC
Next-Gen 911-MO

Recent Job Opportunities
Planner/GIS Specialist
Team Leader- Grape Supply Systems
Geospatial Developer

Recent Discussions
Raster images
cartographic symbology
Telephone Exchange areas in Europe
Problem showcasing Vector map on Windows CE device
Base map

GeoCommunity Mailing List
 
Mailing List Archives

Subject: [gislist] Python script error ArcGIS geoprocessing
Date:  04/25/2007 06:50:00 PM
From:  Louisa Wood



Hi there,
Perhaps this is better in another mailing list, but I thought I'd give you
guys a shot, as this is definitely the best GIS List I subscribe to. I'm
having problems with an ArcGIS processing script I have written in Python.
I'm using ArcGIS 9.0.



Basically, I have a tonne of .dbf files (comma separated), each containing
the fields 'Cell', 'x_Coord', 'y_Coord'. I want to write a script which will
take each on in turn, make an XY event layer from those lat/longs, and then
export each one as a separate point shapefile. I am new to Python and have
developed the following script by piecing together bits and pieces of code
from other existing scripts. I'm trying to debbug it in PythonWin, and I get
an error on the line:
gp.AddToolbox("C:/Program/ArcGIS/ArcToolbox/Toolboxes/Data Management
Tools.tbx")


The error is:

Unhandled exception while debugging...
Traceback (most recent call last):
File "C:Python25XY_to_pt_shp.py", line 18, in
gp.AddToolbox("C:/Program/ArcGIS/ArcToolbox/Toolboxes/Data Management
Tools.tbx")
File "", line 2, in AddToolbox
com_error: (-2147352567, 'Exception occurred.', (0, None, None, None, 0,
-2147467259), None)
Traceback (most recent call last):
File
"C:Python25Libsite-packagespythonwinpywin rameworkscriptutils.py",
line 305, in RunScript
debugger.run(codeObject, __main__.__dict__, start_stepping=1)
File "C:Python25Libsite-packagespythonwinpywindebugger__init__.py",
line 60, in run
_GetCurrentDebugger().run(cmd, globals,locals, start_stepping)
File "C:Python25Libsite-packagespythonwinpywindebuggerdebugger.py",
line 631, in run
exec cmd in globals, locals
File "C:Python25XY_to_pt_shp.py", line 18, in
gp.AddToolbox("C:/Program/ArcGIS/ArcToolbox/Toolboxes/Data Management
Tools.tbx")
File "", line 2, in AddToolbox
com_error: (-2147352567, 'Exception occurred.', (0, None, None, None, 0,
-2147467259), None)

Idon't really understand these error messages. Can anyone help me debug
this? Would be much appreciated :)

Thanks!
Louisa



#
---------------------------------------------------------------------------

#XY_to_pt_shp.py

# Created on: on 2007 04 25

# Created by Louisa Wood

# Module is designed to loop through a set of .dbf files in a folder
C:/RNoutdbf, which contain lat/long information

# for selected cells in a ResNet solution.

# An XY event is generated for each .dbf file, then exported as a shapefile
to folder C:/RNoutshp

#

#
---------------------------------------------------------------------------



# Import system modules

import sys, string, os, win32com.client



# Create the Geoprocessor object

gp = win32com.client.Dispatch("esriGeoprocessing.GpDispatch.1")



# Load required toolboxes...

gp.AddToolbox("C:/Program/ArcGIS/ArcToolbox/Toolboxes/Data Management
Tools.tbx")

gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Conversion
Tools.tbx")



#set input workspace

gp.workspace=("C:/RNoutdbf")



#set output workspace

outworkspace=("C:/RNoutshp")



try:

#Get a list of the dbf tables in the input folder

fcs=GP.ListTables()

#Loop through the list of feature classes

fcs.Reset()

fc=fcs.Next()

# define input table variables

in_Table = fc

in_x = "x_Coord"

in_y = "y_Coord"

out_layer = fc.split(".")[0]

sp_ref = "C:Program FilesArcGISCoordinate SystemsGeographic
Coordinate SystemsWorldWGS 1984"



while fc:

# Process: Make XY Event Layer...

gp.MakeXYEventLayer_management(fc, in_x, in_y, out_layer, sp_ref)



# Process: Feature Class To Shapefile (multiple)...

gp.FeatureClassToShapefile_conversion(out_layer, outworkspace)

fc=fcs.Next()



except:

GP.AddMessage(GP.GetMessages(2))

print GP.GetMessages(2)





_______________________________________________
gislist mailing list
gislist@lists.geocomm.com
http://lists.geocomm.com/mailman/listinfo/gislist

_________________________________
This list is brought to you by
The GeoCommunity
http://www.geocomm.com/

Sponsored by:

For information
regarding
advertising rates
Click Here!

Copyright© 1995-2012 MindSites Group / Privacy Policy

GeoCommunity™, Wireless Developer Network™, GIS Data Depot®, and Spatial News™
including all logos and other service marks
are registered trademarks and trade communities of
MindSites Group