Thiago Comicio
thiagocomicio at gmail.com
Mon Jan 22 10:49:20 EST 2007
On 1/19/07, Graham Dumpleton <grahamd at dscpl.com.au> wrote: > Followups to the mailing list please. > > On 19/01/2007, at 9:55 PM, Thiago Comicio wrote: > > > On 1/18/07, Graham Dumpleton <grahamd at dscpl.com.au> wrote: > >> What version of mod_python are you using, is it an older version? At > >> least upgrade to mod_python 3.2.10 if you haven't already. There are > >> certainly bugs in mod_python 3.1.X which may cause this. > > > > I'm using the version 3.2.8-3.1 fo Fedora 6. I've tried to run this > > boot script with mod_python 3.2.10 without success. > > > >> Also, what > >> Apache configuration do you use for enabling mod_python for that > >> part of the URL namespace? Do you use PythonPath or PythonImport > >> directives? > > > > I didn't understand very well your question, but the PYTHONPATH is > > used to run ZODB, which is part of ZOPE (zope-2.9.6-1.fc6). > > My Apache configuration to access the directory with the python > > scripts is: > > > > <Directory /var/www/html/indico> > > AddHandler python-program .py > > PythonHandler mod_python.publisher > > PythonDebug On > > </Directory> > > The PYTHONPATH setting if required has to be duplicated with equivalent > in mod_python. Ie., add: > > PythonPath "sys.path+['/usr/lib/zope/lib/python']" > Thanks Graham, it worked and my apologies for sending you those emails. Thiago Comicio > Read the documentation for information about the PythonPath directive. > > > When I boot the computer it doesn't work, but when I restart Apache, > > without changing any configuration, it works. > > It works when you do a restart as it is probably inheriting PYTHONPATH > from your user account. The Apache startup script will not have this on > a reboot, so you need to set it up in Apache configuration file. > > > I made some tests. > > When I initialize ZODB at the startup and start Apache after logging > > in, it works. Or, after logging in, I initialize ZODB and Apache, it > > works too. The problem is when I initialize both at the startup, first > > ZODB and then Apache. > > > > Thanks, > > > > Thiago Comicio > > > >> > >> Graham > >> > >> Thiago Comicio wrote .. > >> > On 1/17/07, Graham Dumpleton <grahamd at dscpl.com.au> wrote: > >> > > Thiago Comicio wrote .. > >> > > > Hi, > >> > > > > >> > > > I'm trying to install a program that needs mod_python and > >> ZODB. The > >> > > > program is not running, so I tried to connect to the > >> database through > >> > > > this script: > >> > > > > >> > > > from ZODB import FileStorage, DB > >> > > > > >> > > > def index(req, **params): > >> > > > storage = FileStorage.FileStorage('mydatabase.fs') > >> > > > db = DB(storage) > >> > > > connection = db.open() > >> > > > root = connection.root() > >> > > > return TestPage().getHTML() > >> > > > > >> > > > And I received the error below. > >> > > > Does anybody know how to fix it? > >> > > > >> > > A couple of things to be aware of. > >> > > > >> > > 1. The Apache web server generally runs as a special user and > >> thus that > >> > user > >> > > must have write access to the directory where you are wanting > >> to create > >> > the > >> > > database. > >> > > > >> > > 2. The current working directory is normally '/' for the > >> Apache processes > >> > and > >> > > thus if you do not specify an absolute path to where you want > >> to store > >> > the > >> > > database, it will try and store it in '/' where you are > >> unlikely to have > >> > permissions > >> > > to write. You should not change the working directory as if > >> every handler > >> > did > >> > > that they would all interfere with each other. > >> > > > >> > > Graham > >> > > >> > > >> > Thanks Graham, this solved my initial problem, now I have another. > >> > > >> > I created a simple script to run when I boot my system. > >> > > >> > #main part of the script > >> > PYTHONPATH=/usr/lib/zope/lib/python > >> > > >> > zope=$PYTHONPATH/ZEO/runzeo.py > >> > python=/usr/bin/python > >> > zopeconf=$PYTHONPATH/ZEO/zeo.config > >> > > >> > start() { > >> > echo -n $"Starting $prog1: " > >> > $python $zope -C $zopeconf & > >> > } > >> > > >> > I put a symbolic link at /etc/rc5.d with the name S50myscript and a > >> > symbolink link to http like S85http. > >> > When I try to access a page that needs ZEO I receive the error > >> below, > >> > that disappears when I restart apache. > >> > How can I fix this new problem? > >> > > >> > Thanks, > >> > > >> > Thiago > >> > > >> > ---------------------------------------- > >> > > >> > Mod_python error: "PythonHandler mod_python.publisher" > >> > > >> > Traceback (most recent call last): > >> > > >> > File "/usr/lib/python2.4/site-packages/mod_python/apache.py", > >> line > >> > 299, in HandlerDispatch > >> > result = object(req) > >> > > >> > File "/usr/lib/python2.4/site-packages/mod_python/publisher.py", > >> > line 204, in handler > >> > module = page_cache[req] > >> > > >> > File "/usr/lib/python2.4/site-packages/mod_python/cache.py", line > >> > 82, in __getitem__ > >> > return self._checkitem(name)[2] > >> > > >> > File "/usr/lib/python2.4/site-packages/mod_python/cache.py", line > >> > 124, in _checkitem > >> > value = self.build(key, name, opened, entry) > >> > > >> > File "/usr/lib/python2.4/site-packages/mod_python/publisher.py", > >> > line 77, in build > >> > return ModuleCache.build(self, key, req, opened, entry) > >> > > >> > File "/usr/lib/python2.4/site-packages/mod_python/cache.py", line > >> > 371, in build > >> > exec opened in module.__dict__ > >> > > >> > File "/var/www/html/indico/index.py", line 1, in ? > >> > import MaKaC.webinterface.rh.welcome as welcome > >> > > >> > File "/usr/lib/python2.4/site-packages/MaKaC/webinterface/rh/ > >> welcome.py", > >> > line 1, in ? > >> > import MaKaC.webinterface.rh.base as base > >> > > >> > File "/usr/lib/python2.4/site-packages/MaKaC/webinterface/rh/ > >> base.py", > >> > line 13, in ? > >> > from ZODB.POSException import ConflictError > >> > > >> > ImportError: No module named ZODB.POSException > >> > _______________________________________________ > >> > Mod_python mailing list > >> > Mod_python at modpython.org > >> > http://mailman.modpython.org/mailman/listinfo/mod_python > >> >
|