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?

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

1 Answer 1

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!

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.