Python/Apache Oddness On OSX

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

    #1

    Python/Apache Oddness On OSX

    Hi,

    I'm running Python 2.3.5/2.4.2 on OSX 10.4.2, and am trying to run CGI
    scripts using the builtin Apache. For ease, I've symlinked my custom
    modules into the /Library/Python/2.3/site-packages directory, and they
    import OK via command line python. However, when I perform the import
    from a cgi script, python fails to find the module. It is definately
    something to do with the symlink, as the CGI works OK if I copy the
    directory into site-packages. Is there some oddness with Python/Apache
    and symlink imports?

    Any pointers would be most useful.

    Thanks

    J
  • Diez B. Roggisch

    #2
    Re: Python/Apache Oddness On OSX

    John Abel wrote:[color=blue]
    > Hi,
    >
    > I'm running Python 2.3.5/2.4.2 on OSX 10.4.2, and am trying to run CGI
    > scripts using the builtin Apache. For ease, I've symlinked my custom
    > modules into the /Library/Python/2.3/site-packages directory, and they
    > import OK via command line python. However, when I perform the import
    > from a cgi script, python fails to find the module. It is definately
    > something to do with the symlink, as the CGI works OK if I copy the
    > directory into site-packages. Is there some oddness with Python/Apache
    > and symlink imports?
    >
    > Any pointers would be most useful.[/color]

    Not sure if that is the case here, but I know that apache has some
    directives that are named FollowSymlinks and the like - might be that
    this affects your situation.

    Regards,

    Diez

    Comment

    • grahamd@dscpl.com.au

      #3
      Re: Python/Apache Oddness On OSX

      John Abel wrote:[color=blue]
      > Hi,
      >
      > I'm running Python 2.3.5/2.4.2 on OSX 10.4.2, and am trying to run CGI
      > scripts using the builtin Apache. For ease, I've symlinked my custom
      > modules into the /Library/Python/2.3/site-packages directory, and they
      > import OK via command line python. However, when I perform the import
      > from a cgi script, python fails to find the module. It is definately
      > something to do with the symlink, as the CGI works OK if I copy the
      > directory into site-packages. Is there some oddness with Python/Apache
      > and symlink imports?
      >
      > Any pointers would be most useful.[/color]

      If running OS supplied Apache, it runs as the user "www". Because this
      isn't you or root, check that the directory your symlink points at is
      accessible to others as well as any directories above it back up to the
      root directory. If it isn't accessible, the user Apache runs as will
      not
      be able to find and use the files. When you are copying the directory
      you are possibly giving it read access for others in the process and
      that is why it works then.

      Graham

      Comment

      • John Abel

        #4
        Re: Python/Apache Oddness On OSX

        grahamd@dscpl.c om.au wrote:
        [color=blue]
        >John Abel wrote:
        >
        >[color=green]
        >>Hi,
        >>
        >>I'm running Python 2.3.5/2.4.2 on OSX 10.4.2, and am trying to run CGI
        >>scripts using the builtin Apache. For ease, I've symlinked my custom
        >>modules into the /Library/Python/2.3/site-packages directory, and they
        >>import OK via command line python. However, when I perform the import
        >>from a cgi script, python fails to find the module. It is definately
        >>something to do with the symlink, as the CGI works OK if I copy the
        >>directory into site-packages. Is there some oddness with Python/Apache
        >>and symlink imports?
        >>
        >>Any pointers would be most useful.
        >>
        >>[/color]
        >
        >If running OS supplied Apache, it runs as the user "www". Because this
        >isn't you or root, check that the directory your symlink points at is
        >accessible to others as well as any directories above it back up to the
        >root directory. If it isn't accessible, the user Apache runs as will
        >not
        >be able to find and use the files. When you are copying the directory
        >you are possibly giving it read access for others in the process and
        >that is why it works then.
        >
        >Graham
        >
        >
        >[/color]
        Yup, that's the problem. Just got to figure out OSX's permissions, now.

        Thank you!

        J

        Comment

        Working...