Cannot import mod_python modules

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mark

    #1

    Cannot import mod_python modules

    Hi, I've just installed the Win32 build of mod_python 3.1.4 for Python
    2.4 and have setup my Apache config file with the LoadModule and
    PythonHandler directives and then copied "mod_python .so" to my Apache
    modules directory.

    I restarted Apache and decided to do a quick cgi.test() and it shows
    that mod_python listed under server software section.

    OK, next I tried mptest.py, but I get an Internal Server Error. The
    traceback recorded in the error log says "No module named _apache"

    mptest.py:

    from mod_python import apache

    def handler(req):
    req.write("Hell o World!")
    return apache.OK

    Why doesn't this work? or rather what have I missed?
  • Steve Holden

    #2
    Re: Cannot import mod_python modules

    Mark wrote:[color=blue]
    > Hi, I've just installed the Win32 build of mod_python 3.1.4 for Python
    > 2.4 and have setup my Apache config file with the LoadModule and
    > PythonHandler directives and then copied "mod_python .so" to my Apache
    > modules directory.
    >
    > I restarted Apache and decided to do a quick cgi.test() and it shows
    > that mod_python listed under server software section.
    >
    > OK, next I tried mptest.py, but I get an Internal Server Error. The
    > traceback recorded in the error log says "No module named _apache"
    >
    > mptest.py:
    >
    > from mod_python import apache
    >
    > def handler(req):
    > req.write("Hell o World!")
    > return apache.OK
    >
    > Why doesn't this work? or rather what have I missed?[/color]

    Usually this is a permissions issue, often because you installed
    mod_python as a non-administrator.

    regards
    Steve
    --
    Steve Holden +1 703 861 4237 +1 800 494 3119
    Holden Web LLC http://www.holdenweb.com/
    Python Web Programming http://pydish.holdenweb.com/

    Comment

    • Mark

      #3
      Re: Cannot import mod_python modules

      Thanks for the reply Steve,

      I have re-installed mod_python and re-configured Apache and it works
      now. I'm not exactly sure what I done differently, but oh well at
      least it works now :)

      Regards,

      Mark.

      Comment

      • Steve Holden

        #4
        Re: Cannot import mod_python modules

        Mark wrote:[color=blue]
        > Thanks for the reply Steve,
        >
        > I have re-installed mod_python and re-configured Apache and it works
        > now. I'm not exactly sure what I done differently, but oh well at
        > least it works now :)
        >
        > Regards,
        >
        > Mark.[/color]

        Right, no point wasting much sleep when mod_python awaits!

        regards
        Steve
        --
        Steve Holden +1 703 861 4237 +1 800 494 3119
        Holden Web LLC http://www.holdenweb.com/
        Python Web Programming http://pydish.holdenweb.com/

        Comment

        Working...