Try/except failing to catch exceptions [closed]
This code is an excerpt from a script I wrote: import sys import sqlalchemy as db #import sqlite3,sqlalchemy,sys DBfile = "/etc/SQLAlchemy1_users.db" DBurl = "sqlite:///%s" % DBfile # Defining the Engine try: engine = db.create_engine(DBurl,echo=True) #except (sqlite3.OperationalError,sqlalchemy.exc.OperationalError) as OpenErr: except: sys.stderr.write("ERROR: Cannot open file %s\n" % DBfile) else: print("Database engine created") As part of my testing I'm deliberately trying to create a database file in a directory for which I do not have write permissions. Initially I tried trapping the spe
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.