|
Ville Silventoinen
vsi at ebi.ac.uk
Fri Jun 17 11:44:49 EDT 2005
Hi,
looks like the problem is with xml.sax and expat. I found other
mails about the same problem.
Cheers,
Ville
On Fri, 17 Jun 2005, Ville Silventoinen wrote:
> Hi,
>
> I've been looking for something more extensive than ConfigParser
> for my configuration files, so I tried ZConfig 2.3. I wrote a small
> test module that uses ZConfig, which works ok. When I tried to use
> the same module with mod_python, I get a Segmentation fault.
>
> Has anyone had similar problems using mod_python with ZConfig 2.x?
>
> My test handler looks like this:
>
> from mod_python import apache
> import ZConfig
>
> SCHEMA_FILE = '/homes/vsi/src/spylib/lib/Spy/spyschema.xml'
> CONFIG_FILE = '/homes/vsi/src/spylib/lib/Spy/spy.conf'
>
> def handler(req):
> try:
> req.write("Trying to load configuration...\n");
> schema = ZConfig.loadSchema(SCHEMA_FILE)
> config, handler = ZConfig.loadConfig(schema, CONFIG_FILE)
> req.write("Configuration loaded\n")
> except Exception, e:
> req.write("Failed to load configuration:\n%s" % str(e))
>
> return apache.OK
>
> When called, I see "Trying to load configuration..." and then nothing.
> In Apache error_log I get:
>
> [Fri Jun 17 13:09:31 2005] [notice] mod_python: (Re)importing module
> 'testMPConfig'
> [Fri Jun 17 13:09:33 2005] [notice] child pid 26452 exit signal Segmentation
> fault (11)
>
> This happens every time I call the handler.
>
> My configuration:
>
> LoadModule python_module /ebi/www/main/modules/mod_python.so
>
> <Directory /ebi/www/main/cgi-bin/vsi/test>
> AddHandler mod_python .py
> PythonHandler testMPConfig
> PythonAutoReload On
> PythonDebug On
> </Directory>
>
> My environment:
>
> Apache-2.0.54
> Python-2.4
> mod_python-3.1.3
> ZConfig 2.3 (tried 2.2 as well)
> Red Hat Linux release 9 (Shrike) 2.4.20-8rlx4smp
>
> Any help would be appreciated. I've tried commenting lines out of the
> handler, looks like the problem happens with "loadSchema". I also tried
> to use "loadSchemaFile", but it didn't help.
>
> On the same note, what is the recommended way to handle configuration
> with Python? I'm fairly new to Python. I'd like to have a configuration
> that is reloaded automatically when modified, validation rules, sections
> and proper values (so that integer strings become ints/longs in the
> configuration object, keys with multiple values become lists, etc.)
> Is the best way to write a Python module that contains the configuration?
> This would skip parsing phase and let mod_python reload the module when
> it's been modified.
>
> Thanks,
> Ville
>
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
>
|