Opening a DB Connection

Rich Shepard <[email protected]>
Newsgroups gmane.comp.python.db.pysqlite.user
Message-ID <[email protected]>
   In both the web site documentation and Mike Owens' excellent book (except
for the index), the examples of opening a database connect are:

   con = sqlite3.connect("name.db")

and there is no check for an error condition. As a long time C coder, and
a newcomer to python, I feel uncomfortable assuming that the connection will
be made without error when the application runs.

   Is my worry misplaced? If not, what is the desired way of wrapping the
statement in a test for successful completion?

Thanks,

Rich

-- 
Richard B. Shepard, Ph.D.               |    The Environmental Permitting
Applied Ecosystem Services, Inc.(TM)    |            Accelerator
<http://www.appl-ecosys.com>     Voice: 503-667-4517      Fax: 503-667-8863
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.