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:

[]
PolyGeo
65.5k29 gold badges115 silver badges349 bronze badges
asked Aug 31, 2014 at 4:49
3
  • 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. Commented Aug 31, 2014 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.). Commented Aug 31, 2014 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. Commented Aug 31, 2014 at 16:01

1 Answer 1

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/

answered Aug 31, 2014 at 18:08
1
  • 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... Commented Sep 3, 2014 at 2:02

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.