Hello, I am learning about api interaction and need some help with figuring out how to handle an error in a program.
The program sends an id to a server's api and collects information using urllib. If I run the program 2 consecutive times, this error occurs: <class 'sqlite3.IntegrityError'> column eventid is not unique The error occurs because the same id is being sent to the server, which sends back the same information. I think I can resolve sending the same id to the server, but I want to learn how to handle this error, which could occur if some other server would possibly send the info. Here is the part of the controller code where the error occurs: # collecting info for persistence reasons in order to verify try: db.sometable.insert( eventid = e_id, eventtype = e_type, created = e_createdate ) except SyntaxError, e: print ' problem %s', e db.commit() Here is the model file, repository.py auth.enable_record_versioning(db) db.define_table('repo', Field('eventid','string',unique=True), Field('created','string'), Field('eventtype','string'), Field('added', 'datetime',default=request.now)) db.repo.eventid.requires=IS_NOT_IN_DB(db,'db.repo.eventid') Also, I get the same error if I put the words "IntegrityError" in the except term. I looked in the group, but didn't understand the answers if there were specific ones for this problem. thanks for any help. Margaret -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.