MakeTableView in python script fails after Update to 10.1 on 64 bit OS

492
10
Jump to solution
01-15-2013 10:22 AM
AlexBellak
New Contributor III
After updating to Arc 10.1 a number of my python srcipts now fail, in paticular Python Scripts with MakeTableView fail to read the SDE connection as a valid file location (does not exist or is not supported).

I've copied the data connection & Python script to a 32bit PC and it runs fine as a stand alone script, but when I try to run the script on a 64bit computer the MakeTableView Fails and states that the Input Dataset does not exist or is not supported.

When I add the script to ArcTool box and run it on a 64bit computer, it successfully runs !

-Alex
Tags (2)
Reply
0 Kudos
1 Solution

Accepted Solutions
KevinHibma-old
Regular Contributor III
Your python snippet looks perfect.

Not to be picky on words, but are you saying "server" as in the machine you run the script on, or "ArcGIS Server" is what you installed and run the script against.
If ArcGIS Server is the case, ArcGIS Server at 10.1 is 64bit, thus 64bit Python, thus you need 64bit client libraries when connecting to SDE.

Since you can install the instantclient anywhere, I can't say "go look here".
All I can tell you on this subject is in the PATH environment variable you need to set where to find it.
For example, part of my PATH variable looks like:
C:\Program Files\ArcGIS\instantclient;C:\Program Files (x86)\ArcGIS\instantclient_11_2

I drop the instant client into my 64bit Server install directory and my 32bit ArcMap install directory (thats just how I manage it). Then in my Path (as shown above), I reference the 64bit one first, followed by the 32bit.

View solution in original post

Reply
0 Kudos
10 Replies
MathewCoyle
Frequent Contributor
On your 64-bit machine can you open your SDE connection file in Catalog? Does arcpy.Exists(table) return true?

Are you on SP1?
Reply
0 Kudos
AlexBellak
New Contributor III
On your 64-bit machine can you open your SDE connection file in Catalog? Does arcpy.Exists(table) return true?

Are you on SP1?


I verified that SDE connection does work from ArcCatalog, running the arcpy.Exists(table) from IDLE or just python.exe returns a false,  but running the same script from within ArcCatalog or ArcMap returns a True, which I would expect being the script runs from those enviroments, just not alone using IDLE or as a scheduled task.

I am on SP1, and have the optional background Processing Tools installed, but I see the same thing on another 64 Bit Machine that doesnt have SP 1 or the background processing tools installed.
Reply
0 Kudos
MathewCoyle
Frequent Contributor
Can you verify you only have one version of python installed?

Also check what is in your sys.path list in both IDLE and the ArcGIS python window. They should mostly match.
Reply
0 Kudos
AlexBellak
New Contributor III
Can you verify you only have one version of python installed?

Also check what is in your sys.path list in both IDLE and the ArcGIS python window. They should mostly match.


I'm not too familar with the sys.path in python, I did check my PYTHONPATH and made a adjustment as it was still pointing to the Arc10 directory that no loner existed, but that didnt seem to make a difference. How would I view my sys.path in ArcGIS Python , I do see a Path Browser in Idle and that seems to be pointing to the 64 Bit version of Python that gets installed when I installed the ArcMap Background processor avaible at SP1.
Reply
0 Kudos
KevinHibma-old
Regular Contributor III
If you're indeed using 64bit Background or 64bit Server you may have some extra work to do.
If you're straight up using ArcMap 10.1 on a 64bit machine, this should "just work". ArcMap and Python are 32bit, thus if it ArcMap connects, Python (32bit) will as well.

If you're using a 64bit product (BG or Server) you'll need to ensure you have the 64bit client libraries to connect.
I believe if you're connecting to SQL Server, both the 32 and 64 bit get installed together (so either works). If you're using Oracle, you'll need both 32 and 64 bit versions of the instaclient and properly set up the information in the PATH variable to 64 first, 32 second (assuming you're using the instaclient). Those are the database flavors I know off the top of my head, instructions probably vary depending on other types.

edit: whats the full Python command you're using in your script? Are you doing:
arcpy.MakeFeatureLayer("c:\data\mysde.sde\sde.FC.pts" .... ) or
arcpy.MakeFeatureLayer("database connections\mysde.sde\sde.FC.pts" .... ) ?
AlexBellak
New Contributor III
If you're indeed using 64bit Background or 64bit Server you may have some extra work to do.
If you're straight up using ArcMap 10.1 on a 64bit machine, this should "just work". ArcMap and Python are 32bit, thus if it ArcMap connects, Python (32bit) will as well.

If you're using a 64bit product (BG or Server) you'll need to ensure you have the 64bit client libraries to connect.
I believe if you're connecting to SQL Server, both the 32 and 64 bit get installed together (so either works). If you're using Oracle, you'll need both 32 and 64 bit versions of the instaclient and properly set up the information in the PATH variable to 64 first, 32 second (assuming you're using the instaclient). Those are the database flavors I know off the top of my head, instructions probably vary depending on other types.

edit: whats the full Python command you're using in your script? Are you doing:
arcpy.MakeFeatureLayer("c:\data\mysde.sde\sde.FC.pts" .... ) or
arcpy.MakeFeatureLayer("database connections\mysde.sde\sde.FC.pts" .... ) ?



import arcpy, sys, string, os
SDECONNECTION  =  "c:\\AutomatedGeoprocessing\\SDEConnections\\CLEMIS.sde\\sde.CLEMISGIS.PERSON"

arcpy.MakeTableView_management( SDECONNECTION , "My_TableView" , "LEFT((INCIDENTCODE),2) = 'TR'" )
# then do other stuff, but I cant seem to get past creating the MakeTableView ...


I have a python script that I had (before I updated my server to 10.1) running on a scheduled task, running as 64 is not required if thats the issue. My SDE enviroment that I'm conneting to may very well be ORACLE I'm not 100% sure as its not admin by me, my enviroment is SQL and I seem to be able to connect to that and create a TableView, so I'm starting to think this related to the instaclient thing you mentioned above.
Reply
0 Kudos
KevinHibma-old
Regular Contributor III
Your python snippet looks perfect.

Not to be picky on words, but are you saying "server" as in the machine you run the script on, or "ArcGIS Server" is what you installed and run the script against.
If ArcGIS Server is the case, ArcGIS Server at 10.1 is 64bit, thus 64bit Python, thus you need 64bit client libraries when connecting to SDE.

Since you can install the instantclient anywhere, I can't say "go look here".
All I can tell you on this subject is in the PATH environment variable you need to set where to find it.
For example, part of my PATH variable looks like:
C:\Program Files\ArcGIS\instantclient;C:\Program Files (x86)\ArcGIS\instantclient_11_2

I drop the instant client into my 64bit Server install directory and my 32bit ArcMap install directory (thats just how I manage it). Then in my Path (as shown above), I reference the 64bit one first, followed by the 32bit.

View solution in original post

Reply
0 Kudos
AlexBellak
New Contributor III
Your python snippet looks perfect.

Not to be picky on words, but are you saying "server" as in the machine you run the script on, or "ArcGIS Server" is what you installed and run the script against.
If ArcGIS Server is the case, ArcGIS Server at 10.1 is 64bit, thus 64bit Python, thus you need 64bit client libraries when connecting to SDE.

Since you can install the instantclient anywhere, I can't say "go look here".
All I can tell you on this subject is in the PATH environment variable you need to set where to find it.
For example, part of my PATH variable looks like:
C:\Program Files\ArcGIS\instantclient;C:\Program Files (x86)\ArcGIS\instantclient_11_2

I drop the instant client into my 64bit Server install directory and my 32bit ArcMap install directory (thats just how I manage it). Then in my Path (as shown above), I reference the 64bit one first, followed by the 32bit.




Thank you Kevin, I'm going to install the Oracle instaclient right now, will follow up if this is the solution, as I'm sure others will run into this, if they havent already.

Thank you have taking the time, By the way I'm a Big Fan of your ServerAdminToolkit, thats awesome!!
Reply
0 Kudos
AlexBellak
New Contributor III
Thank you Kevin, I'm going to install the Oracle instaclient right now, will follow up if this is the solution, as I'm sure others will run into this, if they havent already.

Thank you have taking the time, By the way I'm a Big Fan of your ServerAdminToolkit, thats awesome!!


reinstalling Python and installing the ORACLE instaclient seem to correct the issue.
Reply
0 Kudos