Quantcast
Channel: Forums - ArcObjects SDKs
Viewing all articles
Browse latest Browse all 1374

Running python script from VB.net

$
0
0
I'm trying to implement the code in the following article:

http://resources.arcgis.com/en/help/...0000m0s000000/

As the article recommends, I passed the following to the function: "python C:\temp\Del_tLUMPCCases_KNO.py". This executes the script and it gets the job done, but I get a Windows error that pops up and states that the Python.exe has crashed: check online for a solution and close or close. This could cause the user to think that the entire vb.net .exe process has also crashed

I've tried just the path to my python script: Dim command As String = "C:\temp\Del_tLUMPCCases_KNO.py"

I've tried calling the python exe and then the path to my script: Dim command As String = "C:\Python27\ArcGISx6410.2\python.exe C:\temp\Del_tLUMPCCases_KNO.py". This works without crashing when executed through the cmd prompt or pasting that string into Windows Explorer. When I do this, it launches the python console with the heading "C:\Python27\ArcGISx6410.2\python.exe", so I presume that's the correct executable to try to use (I'm using a 64bit Win7 machine). And when executed this way, the python script functions properly, which is to delete a table from a geodatabase - without a notification that python.exe has crashed.

Are there other ways to simulate pasting the above examples into the cmd prompt - but from vb.net? It needs to be synchronous - this python must complete before my vb.net exe goes to the next line of code.

The reason I'm using python is because I tried just about every way to call a geoprocessing tool or model using ESRI.ArcGIS.Geoprocessing.IGeoProcessor2 and ESRI.ArcGIS.Geoprocessor.Geoprocessor. Every time I delete a table through these methods, my vb.net exe crashes. I execute the tools in a Try Catch block and it never invokes the code in the catch block. The exe just shutsdown immediately.

Viewing all articles
Browse latest Browse all 1374

Trending Articles