3

I am coding a VB.net console application using ArcObjects to call ArcGIS 10.1 geoprocessing tools. I have several geoprocessing calls that actually work, but that pop up an irritating message box when I call them from code. This is a problem because I need to run my application in batch at the command line and this message box pauses the application while it waits for input.

enter image description here

The message box appears consistently on certain geoprocessing calls, but not for all calls. The two main culprits are "Calculate Field" and "Raster Calculator". Below is an example of the former:

Dim GP As New Geoprocessor
Dim CalcFieldTool As New CalculateField
CalcFieldTool.in_table = pFClass
CalcFieldTool.field = "Elevation"
CalcFieldTool.expression = "!RASTERVALU!"
CalcFieldTool.expression_type = "PYTHON"
CalcFieldTool.code_block = " "
GP.Execute(CalcFieldTool, Nothing)

The messages does NOT appear if I use VBA syntax for the calls instead of Python. However, my application has to run against ArcGIS Server which does not (and cannot) include VBA, and so I am tied to Python Syntax. Also, the message box does not appear when I run the same geoprocessing tools in ArcGIS Desktop.

This code works and the Elevation field is indeed updated with the values from the RASTERVALU field. I am just need to avoid the message box popping up. Also note that this is well tested code and used to work without the popup until recently... perhaps ArcGIS 10.1 service pack 1. (I cannot upgrade to 10.2.)

I am now almost certain that this is related to an architecture mis-match somewhere. My computer is 64 bit, ArcGIS is 32 bit, my console application is compiled as 32 bit (not Any CPU) and I have both the original 32 bit version of Python installed as well as the ArcGIS 10.1 Service Pack 1 64 bit background geoprocessing download installed. But I am unsure how to direct my code to use the latter.

  • You have a tag for background-geoprocessing but do not mention using that in the body of your question. My first thought is that you should make sure that you are not using background Geoprocessing so that you can be sure there is no confusion between the 32bit and 64bit versions of Python that may be present. – PolyGeo Jul 24 '14 at 0:26
  • Thank you! This definitely sounds related. I have not installed the background processing bundle (and am working on a new, clean computer that has never had it). My machine is natively 64 bit, but obviously ArcGIS Desktop is still 32 bit. Should I be doing anything specific to force foreground processing? Or should I attempt to install the background processing bundle? – user2723146 Jul 24 '14 at 0:35
  • FYI: I was compiling using the x86 architecture. I changed to AnyCPU after reading this ESRI post, but now my application won't start because it can't find ArcGISVersion.dll. Thoughts? – user2723146 Jul 24 '14 at 0:40
  • This is not an area of my expertise but I just added an arcobjects tag, which with arcgis-server should put it in the path of others with those skills. – PolyGeo Jul 24 '14 at 0:44
  • Don't know if this will make a difference but change expression_type to "PYTHON_9.3". I only say this as all the examples in the Help file use this... – Hornbydd Jul 24 '14 at 9:19
3

Had a quick search on Google for what R6034 meant and here are some threads, it may not even be anything to do with ArcMap:

And a whole load more...

2

I have eventually solved the issue, based on the post by Hornbydd. As he suggested, something in my PATH environment variable was causing mixed architecture (32 and 64 bit) DLLs to get loaded.

1) I downloaded and installed ESRI's 64 bit geoprocessing software for ArcGIS 10.1 Service Pack 1. I had read somewhere else that Python uses a service to call background processing and suspected that the service might be 64 bit (like my computer) while the Python tools themselves were 32 bit. (Note that this install alone didn't fix the issue.)

2) Opened a DOS prompt and set the PATH environment variable to the 64 bit version of Python.

SET PATH C:\Python27\ArcGISx6410.1;C:\Python27\ArcGISx6410.1\DLLs

3) Ran my console application directly in the same DOS prompt window. Solved! No annoying pop-up. This does mean that the tool still pops-up the message box when running in the debugger, but I can live with that now that I can successfully run it in batch mode.

1

As a workaround, the documentation recommends calling Python from out of process. While the topic is on ArcPy, it should apply to anything that uses Python in the stack.

I'd strongly recommend contacting Esri support to address this particular issue, though. It may already be in their knowledge base with a solution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.