Python script runs in 10 but not 10.1 - using .odc connection

3398
22
Jump to solution
03-07-2013 04:41 AM
NathanHuggins
New Contributor
I currently have a script that pulls information from a Microsoft SQL Server Table View and exports it to a file geodatabase using an .odc connection. This script will run fine in version 10.0, but will error out using version 10.1. Giving the error message ERROR 000732: ... does not exist or is not supported. The strange thing is that I can build a model in ArcCatalog that will run successfully, then export that model to python, and that script will fail. So basically the geoprocessing tool will run with ArcCatalog open, but not as a python script.

Has ESRI changed something with regards to using .odc connections and MS SQL Server Views?? Or does anyone have a workaround? Below is some example code. Again runs fine in 10 but not in 10.1.

# Local variables: dbo_cosSewerManholes = "Database Connections\\Han8Live.odc\\dbo.cosSewerManholes" Infor_gdb = "D:\\Temp\\Infor.gdb"  # Process: Table to Table arcpy.TableToTable_conversion(dbo_cosSewerManholes, Infor_gdb, "manholes_view") print "done" 
Tags (2)
0 Kudos
22 Replies
MichaelVolz
Esteemed Contributor
Nathan:

Are you running this as a standalone script where you explicitly determine which version of python you are running?

If so, maybe you do not realize that you are running in the 64 bit python environment, so you need to point the script to use 32 bit python where the ODBC connections are supported.
0 Kudos
NathanHuggins
New Contributor
Solved, sort of. Thanks for all the suggestions Michael and Curtis. As you suspected it had to do with the 64-bit background geoprocessing. I was able to successfully run the script after uninstalling the 64-bit background processing and running a "repair" of ArcGIS to reestablish the 32-bit python file relationships. As you stated OLEDB connections are not supported in 64-bit processing. That raises another question. Could I have kept the 64-bit background geoprocessing and specified python to run in 32-bit mode?

Michael: ...so you need to point the script to use 32 bit python where the ODBC connections are supported.
Does anyone have a simple example of how specify that a script runs in 32-bit?? Or do you just change the Windows file associations?? My script will be running as a scheduled task that launches a .py file.

Thanks again for the all the help!
0 Kudos
MichaelVolz
Esteemed Contributor
Nathan:

Here is a portion of a bat file that I call from a scheduled task that calls a python sxcript.

@echo off
echo Start time: %time% > Address_Research_Data_Update.log

echo ------------  Update time: %time%
echo ------------  Geocoding Parcel_Publish with Address_Data  -------------
echo ------------  Geocoding Parcel_Publish with Address_Data  ------------- >> Address_Research_Data_Update.log
c:\Python27\ArcGISx6410.1\python.exe Geocode_Address_Data.py >> Address_Research_Data_Update.log
This calls the 64 bit python version

I could change the last line to
c:\Python27\ArcGIS10.1\python.exe Geocode_Address_Data.py >> Address_Research_Data_Update.log
and I would be using the 32 bit python version which would support the odc connections.
0 Kudos
NathanHuggins
New Contributor
Michael,

Thanks for the example. I don't have much experience writing bat files, but I do see where you could specify Python to use the 32-bit .exe. Going forward it might be something I will have to look into utilizing more.

Thanks again for all the information.
0 Kudos
ChrisFox3
Occasional Contributor III
Alternatively you could do something like this, inside your action set the program/script to path of the 32 bit python exe and in the Add arguements set it equal to the path to the python script. You could also then add additional arguements if your python script takes arguements.

[ATTACH=CONFIG]22457[/ATTACH]
0 Kudos
MichaelVolz
Esteemed Contributor
Thanks Chris.  I did not realize you could use the Program/script parameter to call the python executable file and the Add arguments parameter to call the specific python script.  I will see how this setup works for simple scripts where I just need to make a call to a single python script.
0 Kudos
curtvprice
MVP Esteemed Contributor
Alternatively you could do something like this, inside your action set the program/script to path of the 32 bit python exe and in the Add arguements set it equal to the path to the python script.


I usually use a .bat file driver with scheduled tasks so I can capture any error messages from stderr, in case something goes wrong at the system level, or the Python script writes something to stderr:

C:\Python27\ArcGIS10.1\python.exe Geocode_Address_Data.py ^
  >> Address_Research_Data_Update.log 2>&1
0 Kudos
RandyKreuziger
Occasional Contributor III
Solved, sort of. Thanks for all the suggestions Michael and Curtis. As you suspected it had to do with the 64-bit background geoprocessing. I was able to successfully run the script after uninstalling the 64-bit background processing and running a "repair" of ArcGIS to reestablish the 32-bit python file relationships. As you stated OLEDB connections are not supported in 64-bit processing. That raises another question. Could I have kept the 64-bit background geoprocessing and specified python to run in 32-bit mode?

Does anyone have a simple example of how specify that a script runs in 32-bit?? Or do you just change the Windows file associations?? My script will be running as a scheduled task that launches a .py file.

Thanks again for the all the help!


If OLEDB connections are not support with 64-bit processing what happens when ESRI puts out a 64-bit only version of ArcGIS desktop?
0 Kudos
MichaelVolz
Esteemed Contributor
That is the same question I was thinking about when ESRI does upgrade desktop to 64 bit.

Does anyone from ESRI have any details on this subject moving forward?
0 Kudos
KevinHibma
Esri Regular Contributor
I dont have detailed information on the OLEDB story but I do know we're working to support them in 64bit to some degree (I dont know if thats 100% of what we did in 32bit or just some part of that full support).

In Server 10.2 we've made progress and you can use it as a datasource (Server 10.1 you cannot).
I'm still working on the 64bit Background story.

So: when we move to 64bit (all products), it will hopefully be a none issue (ie, we're working that out right now in the 64bit products we have)
0 Kudos