Help... Use Shelve in CGI script? -- Nevermind

J Black burntbit at earthlink.net
Wed Nov 24 01:00:35 EST 2004


Hello,

  I recently came across the shelve module and fell in love with it.  It
works fine on the command line... But when I put the same code into the cgi
script it crashes everytime.  Here's the output from the cgi crash.

Traceback (most recent call last):
  File "/var/www/cgi-bin/test.cgi", line 8, in ?
    db = shelve.open("register", "c")
  File "/usr/lib/python2.3/shelve.py", line 231, in open
    return DbfilenameShelf(filename, flag, protocol, writeback, binary)
  File "/usr/lib/python2.3/shelve.py", line 212, in __init__
    Shelf.__init__(self, anydbm.open(filename, flag), protocol, writeback,
binar
y)
  File "/usr/lib/python2.3/anydbm.py", line 83, in open
    return mod.open(file, flag, mode)
  File "/usr/lib/python2.3/dbhash.py", line 16, in open
    return bsddb.hashopen(file, flag, mode)
  File "/usr/lib/python2.3/bsddb/__init__.py", line 192, in hashopen
    d.open(file, db.DB_HASH, flags, mode)
bsddb._db.DBAccessError: (13, 'Permission denied')
Exception exceptions.AttributeError: "DbfilenameShelf instance has no
attribute
'writeback'" in  ignored
[Wed Nov 24 00:49:37 2004] [error] [client 127.0.0.1] Premature end of
script he
aders: /var/www/cgi-bin/test.cgi

---------

Now this line bsddb._db.DBAccessError: (13, 'Permission denied') says
permission denied.  How do I get the permission to use it in my cgi script
for the Apache web server?  I tried already having a valid... oh wait.  I
got it.

The way I just got it working is as follows.  I generated a database file in
my home folder. (Cause another error I was getting was wrong database
lookup).  So I took this working database file and put it in my cgi
directory.  Then to make it work I changed it to world readable and
writable.  Then the cgi script ran just fine :-).



More information about the Python-list mailing list