Declare self.cursor

Mel mwilson at the-wire.com
Tue Aug 24 13:39:23 EDT 2010


Dani Valverde wrote:

> Hello!
> I am working on a GUI to connect to a MySQL database using MySQLdb (code
> in attached file). I define the cursor in lines 55-66 in the OnLogin
> function within the LoginDlg class.
> 
> /db= MySQLdb.connect(host='localhost', user=Username , passwd=pwd,
> db='Ornithobase')
> self.cursor = db.cursor()/
> 
> When I try to use the cursor on another part of the code (EditUser
> class, line 176)
> 
> /sql = 'select substring_index(CURRENT_USER(),"@",1)'
> login.cursor.execute(sql)/
> 
> I get this error:
> 
> /AttributeError: 'LoginDlg' object has no attribute 'cursor'/
> 
> You can check the code for details, I think is better.

Did you actually click the loginBtn?

	Mel.




More information about the Python-list mailing list