import anydbm
Morten Gulbrandsen
morten at pool.informatik.rwth-aachen.de
Tue Jun 19 06:02:02 EDT 2001
Hello,
I have a small python problem,
#!/usr/bin/python
import anydbm
file = anydbm.open("filename.txt") # link to external file
file['key'] = 'data' # store data by key
data = file['key'] # fetch data by key
import cgi
form = cgi.FieldStorage() # parse form data (stdin, environ)
if form.has_key('name'):
showReply('Hello, ' + form['name'].value)
"""
morten at debian:~/Python/lpython/unix/examples$ chmod u+x *.py
morten at debian:~/Python/lpython/unix/examples$ ls -l *.py
-rwxr--r-- 1 morten morten 857 Jun 19 11:56 page054.py
morten at debian:~/Python/lpython/unix/examples$ ./page054.py
Traceback (innermost last):
File "./page054.py", line 5, in ?
file = anydbm.open("filename.txt") # link to external file
File "/usr/lib/python1.5/anydbm.py", line 80, in open
raise error, "need 'c' or 'n' flag to open new db"
anydbm.error: need 'c' or 'n' flag to open new db
morten at debian:~/Python/lpython/unix/examples$
example typed from page 54 Learning Python
Oreilley Help For programmers,
written by Mark Lutz
what am I doing wrong ?
"""
Yours Sincerely
Morten Gulbrandsen
More information about the Python-list
mailing list