Problem with using ConfigParser.py

Anthony Raj anthony_raj at persistent.co.in
Thu Jun 21 10:09:34 EDT 2007


Hi Folks,

 

Having a very strange problem in using python with apache/mod_python. 

 

[conf.py attached]

>>> from ast.conf import conf
>>> c = conf()
>>> a = c.readPath('sandbox')
>>>  len (a)

>>>  30

 

The same code when run thru the a web script gives following error -

>>>> 

[Errno 13] Permission denied: '/home/ast/ast-linux.conf'

 
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 213,
in handler
    published = publish_object(req, object)
 
  File "/usr/lib/python2.4/site-packages/mod_python/publisher.py", line 412,
in publish_object
    return publish_object(req,util.apply_fs_data(object, req.form, req=req))
 
  File "/usr/lib/python2.4/site-packages/mod_python/util.py", line 439, in
apply_fs_data
    return object(**args)
 
  File "/var/www/html/ast-sandbox/testConf.py", line 9, in index
    path = c.readPath('sandbox')
 
  File "/usr/lib/python2.4/ast/conf.py", line 40, in readPath
    self.vars = self.conf.options(target)
 
  File "/usr/lib/python2.4/ConfigParser.py", line 241, in options
    raise NoSectionError(section)
 
NoSectionError: No section: 'sandbox'

>>>>> 

 

WebScript -

----

import sys

from ast.conf import conf

 

def index(req, **kw):

    sys.stdout = req

    req.content_type = 'text/html'

 

    c = conf()

    path = c.readPath('sandbox')

    print path

----

 

The configuration file is the standard format used by ConfigParser module.

 

The permission for the ast-linux.conf file is the same as the user/group
defined in httpd.conf.

 

[root at CVS ast-sandbox]# ls -l /home/ast/ast-linux.conf

-rw-rw-rw- 1 777 ast 7936 Jun 21 11:11 /home/ast/ast-linux.conf

 

Any pointers would help.

 

TIA

~Anthony

 


DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the property of Persistent Systems Pvt. Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Pvt. Ltd. does not accept any liability for virus infected mails.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20070621/66e34e21/attachment.html>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: conf.py
URL: <http://mail.python.org/pipermail/python-list/attachments/20070621/66e34e21/attachment.ksh>


More information about the Python-list mailing list