Advertisement
Guest User

Untitled

a guest
Feb 17th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. import mysql.connector,sys
  2. try:
  3. cnx = mysql.connector.connect (host='localhost', user = 'user', password = 'user@543', port= 3306)
  4. except mysql.connector.errors.ProgrammingError, e:
  5. print time.strftime("%Y-%m-%d %H:%M:%S"),"Error %s" % (e)
  6. sys.exit(1)
  7. except mysql.connector.errors.InterfaceError, e1:
  8. print time.strftime("%Y-%m-%d %H:%M:%S"),"Error %s" % (e1)
  9. sys.exit(1)
  10. cursor = db.cursor()
  11. cursor.execute("select version()")
  12. result_set = cursor.fetchall()
  13. print result_set
  14.  
  15. Traceback (most recent call last):
  16. File "test.py", line 3, in <module>
  17. cnx = mysql.connector.connect (host='localhost', user = 'user', password = 'user@543', port= 3306)
  18. AttributeError: 'str' object has no attribute 'connector'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement