473,407 Members | 2,312 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Help with dbm TypeError

I am writing a web application for mod_python that catalogs my home
(book) library. For now, I am using the Python dbm module to store
string representations of mod_python's req.form (using the
mod_python.publisher handler) using unique IDs as keys. In the .db
file, there is a key 'next' that holds the next key for the next form
submission. A TypeError exception is raised though when I attempt to
increment the 'next' key. This only occurs in mod_python.

This code...

self._db['next'] = str(int(self._db['next'])+1)

raises this exception....

TypeError: string indices must be integers
y = dbm.open("Test","c")
next = 0
y['next'] = str(next)
y['next'] = str(int(y['next'])+1)
y['next'] '1' y['next'] = str(int(y['next'])+1)
y['next']

'2'

I do not understand the cause of this exception. I am using Python
2.3.5. Any help would be greatly appreciated.

Ryan Kaskel

Jan 9 '06 #1
0 1050

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Tuxtrax | last post by:
Hi all. I have need of assistance on something that should be very simple, and is driving me absolutely batty. This is a code snippet from a short program that downloads news headers via...
2
by: Thorsten Kampe | last post by:
What is the best way to except two errors, when the except handling in both cases is the same? "except:" would just except every error and not just those I want. except Attribute error:...
7
by: ‘5ÛHH575-UAZWKVVP-7H2H48V3 | last post by:
(see end of message for example code) When an instance has a dynamically assigned instance method, deepcopy throws a TypeError with the message "TypeError: instancemethod expected at least 2...
3
by: bearophileHUGS | last post by:
Hello, here I extend the idea of the smart help I've discussed recently. When I receive an error like: TypeError: fun() takes exactly 2 arguments (1 given) I'd also like to see that...
0
by: siddharthram | last post by:
Hello, I'd appreciate some help figuring out what I might be doing wrong. I am trying to extend Python to add some modules. However, when the code appended below runs, the conversion always...
0
by: ryan k | last post by:
I am writing a web application for mod_python that catalogs my home (book) library. For now, I am using the Python dbm module to store string representations of mod_python's req.form (using the...
1
by: Paul Du Bois | last post by:
Using win32 python 2.4.1, I have a minimal test program: def generate(): raise TypeError('blah') yield "" print "\n".join((generate())) Executing the program gives:
1
by: T.Crane | last post by:
Hi, OK, I'm trying to figure out how to use the ODE solver (scipy.integrate.ode.ode). Here's what I'm doing (in iPython) y0 = dt = 0.01 tEnd = 12 t0 = 0 Y = zeros()
0
by: Niklas Norrthon | last post by:
On 24 Juli, 00:30, Samir <spytho...@gmail.comwrote: 'int' object is not callable... hmmm... Traceback (most recent call last):
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.