2

I'm trying to write a Python script that imports arcgisscripting (stuck on 9.3.1 here) which is then run as CGI by a web app. It runs fine from the Windows command line but as soon as I drop it into the app it throws an Error 500: Internal Server Error. I checked the Apache logs and sure enough there's a ImportError: No module named arcgisscripting. All of my other modules are working fine (sys, os, etc.) Does anybody know what could be the issue here?

Update: I think it might have something to do with this: Why can't python find some modules when I'm running CGI scripts from the web?

  • Did you try the solution offered in your update? Make sure your arcgisscripting module is globally available to all users on your machine. – Radar Sep 4 '13 at 18:07
  • Just did - problem solved! – Rob Sep 4 '13 at 18:32
3

The link in the question had the answer... The location of arcgisscripting is defined in the Windows environment variable PYTHONPATH. By printing sys.path from a CGI script I could tell this was missing from the variables Apache was using. Easy fix: add this to httpd.conf:

SetEnv PYTHONPATH "c:/path/to/pythonpath"

And no more ImportError!

| improve this answer | |

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.