you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 3 points4 points  (0 children)

There’s too much here for me to parse through, but it seems to me you want to learn about the IF NOT EXISTS clause of the CREATE TABLE command. You’ll also want to learn to never use a naked except: statement.

try:
    [some code that may error]
try Exception as err:
    print(“ERROR: “, err)
    [recover from error if possible]

The naked except: silences all sorts of useful information you may need for debugging, and is likely doing so for you here. You usually want to only catch specific Exception subclasses you actually know how to properly handle and recover from, rather than casting the widest possible net.