Solved! Go to Solution.
I just installed 10.1 on my PC. Now when I run my Python script it no longer recognizes any connection coded like "Database Connection\Connection to ...". These connections work in ArcMap and ArcCatalog. When I create a Model using these connections, the model works. When I export the Model to a Python script the model it fails. If I replace the "Database Connections\..." path prefix with something like "C:\Users\SomeUser\AppData\Roaming\ESRI\Desktop10.1\ArcCatalog\..." it works. In short Python is not resolving "Database Connections" to the actual location of the connections (ie. "C:\Users\SomeUser\AppData\Roaming\ESRI\Desktop10.1\ArcCatalog"). I have SP1 installed on the ArcGIS 10.1 for Desktop. My C: drive has both a "Python26" and a "Python27" directory. Maybe its getting confused where to run Python? Also it looks like ArcCatalog/ArcMap run as 32 bit where as Python runs as 64-bit. Is there something I can do to configure the 64-bit side to find "Database Connections".
Please help! Thanks!
How are you running the python script? To be sure you are running against the same version of python ArcGIS Desktop will run you can explicitly call the version of python from a command prompt and then pass in the path to the script. This blog talks about it, but specifically in regards to targeting the 64 bit install of python. You can do the same for the 32 bit install.
http://blogs.esri.com/esri/arcgis/2012/11/12/python-scripting-with-64-bit-processing/
This is not a bug in the software. When you run python against the 64 bit install of python and arcpy, you are running against the Server install and Server doesn't know about the relative location of the "Database Connections" which lives under the Desktop10.X folder in your user profile. If you publish a geoprocessing script tool to Server that has a hardcoded path to Database Connections we actually copy the connection file as part of the package and modify the script to point to the packaged connection file.
So your options are to reference the full path to the connection file or always ensure you are running the script against the 32 bit or Destkop install of python.