[portland] Error: object does not support item assignment

Robin Dunn robin at alldunn.com
Wed Dec 7 19:28:06 CET 2011


On 12/7/11 9:41 AM, Rich Shepard wrote:
> Yesterday I sent this to the wxPython mail list and no one's responded.
> I'd like to move forward with this project so I'm asking for help here.
>
> I'm writing a wxPython application to enter data into a postgres table
> (using psycopg2). There is a class written by someone else as part of a
> database query tool that I'm using to set up the database connection. The
> class runs as a stand-alone application. I don't know how to approach
> resolving this problem.
>
> The error stopping the python script is:
>
> Traceback (most recent call last):
> File "./biolwq.py", line 513, in <module>
> frame_1 = OneFrame(None, -1, "")
> File "./biolwq.py", line 59, in __init__
> self.projDB = LoginDialog(self)
> File
> "/.../postgresLogin.py",
> line 92, in __init__
> data['port']='5432' TypeError: 'OneFrame' object does not support item
> assignment
>
> Lines 86-92 in postgresLogin.py are:
>
> if field == 'port':
> try:
> port_t.SetValue(environ['PGPORT'])
> data['port']=port_t.GetValue()
> except KeyError:
> port_t.SetValue('5432')
> data['port']='5432'
>
> The postgres port is the only value explicitly set; the others are blank
> text control widgets waiting for user input.
>

It looks to me like you are expected to be passing a dictionary (or some 
other mapping type) to LoginDialog rather than the frame.


-- 
Robin Dunn
Software Craftsman
http://wxPython.org



More information about the Portland mailing list