473,799 Members | 3,255 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
Oct 24 '05 #1
3 1795
John Abel wrote:
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.


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
Oct 24 '05 #2
John Abel wrote:
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.


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

Oct 24 '05 #3
gr*****@dscpl.c om.au wrote:
John Abel wrote:

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.


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

Yup, that's the problem. Just got to figure out OSX's permissions, now.

Thank you!

J
Oct 25 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

28
4620
by: Erik Johnson | last post by:
This is somewhat a NEWBIE question... My company maintains a small RDBS driven website. We currently generate HTML using PHP. I've hacked a bit in Python, and generally think it is a rather cool language. I've done Perl and like it, there are a few features of PHP I like but overall am not too excited about it. I have found PHP's strtotime() function to be quite flexible and handy and we make liberal use of it. I have not yet really...
1
2793
by: neha | last post by:
hi, i m trying to integrate python with apache on linux.For this i m using mod_python. I dont see any problem with the versions of python,apache and mod_python i m using. the versions i m using are apache version2. mod_python v3.1.14 python2.4 The problem is,when i m running my python script,after starting apache
7
1824
by: Ben Finney | last post by:
Howdy all, I'm working on a web application that is starting to gain a lot of back-end code written in Python. However, all the current interface code is written in legacy PHP. I'd like to slowly introduce new features as Python WSGI programs. Is it possible to write a Python WSGI program that talks to a PHP program as its "back end"? Where can I find out how to do this, preferably with examples?
852
28771
by: Mark Tarver | last post by:
How do you compare Python to Lisp? What specific advantages do you think that one has over the other? Note I'm not a Python person and I have no axes to grind here. This is just a question for my general education. Mark
113
5320
by: John Nagle | last post by:
The major complaint I have about Python is that the packages which connect it to other software components all seem to have serious problems. As long as you don't need to talk to anything outside the Python world, you're fine. But once you do, things go downhill. MySQLdb has version and platform compatibility problems. So does M2Crypto. The built-in SSL support is weak. Even basic sockets don't quite work right; the socket module...
3
4945
by: joe jacob | last post by:
I configured apache to execute python scripts using mod_python handler. I followed below mentioned steps to configure apache. 1. In http.conf I added <Directory "D:/softwares/Apache2.2/htdocs"> AddHandler mod_python .py PythonHandler mptest PythonDebug On </Directory>
70
2668
by: TheFlyingDutchman | last post by:
Python user and advocate Bruce Eckel is disappointed with the additions (or lack of additions) in Python 3: http://www.artima.com/weblogs/viewpost.jsp?thread=214112
29
5956
by: Carl Banks | last post by:
Anyone with me here? (I know the deadline for P3 PEPs has passed; this is just talk.) Not many people are bit-fiddling these days. One of the main uses of bit fields is flags, but that's not often done in Python because of keyword arguments and dicts, which are lot more versatile. Another major use, talking to hardware, is not something oft done in Python either. It seems like this occasional usage wouldn't justify having built-in...
8
2030
by: Lie | last post by:
Inspect the following code: --- start of code --- import Tkinter as Tk from Tkconstants import * root = Tk.Tk() e1 = Tk.Entry(root, text = 'Hello World') e2 = Tk.Entry(root, text = 'Hello World')
0
9687
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9541
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10252
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10027
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7565
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6805
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5463
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4141
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3759
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.