3

I have a fresh install of ArcGIS Server and ArcGIS for Desktop both 10.2, latest patches applied. The data is served in this application from a PostgresSQL enterprise geodatabase. The problem is that I can connect to the database using ArcMap, on the ArcGIS Server (the maps that have their data source set in the database) and I can run python scripts that interact with the database in the python console in ArcMap. Yet, the same scripts, or even the smallest interactions (e.g. listing the feature classes with arcpy.ListFeatureClasses()) does not work stand alone in python command line. I have tried both the 32 bit and 64 bit Python installations that came with the server and desktop and none run any smallest interactions with the geodatabase. Any thoughts?

For reference, a small snippet of code that fails:

import arcpy
arcpy.env.workspace = 'path/connection.sde'
arcpy.ListFeatureClasses()

returns:

[]
  • 1
    So, you have a .py file with this chunk of code. You call it from the cmd like C:\pythonfile.py. Then you get nothing back in the cmd window? Check the path to the workspace (r'C:\files\sdeconn.sde') and use print arcpy.ListFeatureClasses(). I am able to get the a list back printed in the cmd when listing feature classes from Postgres. – Alex Tereshenkov Aug 31 '14 at 6:57
  • I used to be able to run this before (the actual script is much longer than this but this is a minimially demonstrating code). This is a new installation, from scratch (windows, etc.). – Mahdi Aug 31 '14 at 15:57
  • Either if you run it as an script, or in in interactive mode (i.e. after running python). The interesting thing is that it only works in ArcMap's python window but the same python.exe that it runs is not able to run it. It makes me think that there is some environment variable or path not set properly but I have checked the environment variables with os.environ against each other and there is no significant difference. – Mahdi Aug 31 '14 at 16:01
1

I finally figured that the culprit was my scipy installation and its incompatibilities with the numpy inlcuded with arcpy, etc. Solution: a repair put everything back in order and database connections work perfect.

Now my problem is to find a working 64-bit numpy-scipy stack that does plays well with ArcGIS. For 32-bit, the official 32-bit release from here does the trick. So far no success with the well known binaries from http://www.lfd.uci.edu/~gohlke/pythonlibs/

  • My final solution is basically using an older (working) 64-bit installation I had before my fresh install. I think it is mostly ESRI's problem not to use up to date Numpy API, but perhaps that is for compatibility... – Mahdi Sep 3 '14 at 2:02

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.