Hi,
You're right, if the databse doesn't exist, the sqlite3 library will simply
create it.
Hmm, in that case, what is the Pythonic way to handle this then?
If the database is new, then it won't have the table I need, and it will return
something like:
sqlite3.OperationalError: no such tab
Op 28-10-13 07:18, Steven D'Aprano schreef:
> On Sun, 27 Oct 2013 20:43:07 -0700, Victor Hooi wrote:
>
>> Hi,
>>
>> I'd like to double-check something regarding using try-except for
>> controlling flow.
>>
>> I have a script that needs to lookup things in a SQLite database.
>>
>> If the SQLite dat
On 10/28/13 05:43, Victor Hooi wrote:
> Hi,
>
> I'd like to double-check something regarding using try-except for controlling
> flow.
>
> I have a script that needs to lookup things in a SQLite database.
>
> If the SQLite database file doesn't exist, I'd like to create an empty
> database, and th
On Mon, 28 Oct 2013 18:01:49 +1100, Chris Angelico wrote:
> On Mon, Oct 28, 2013 at 5:57 PM, Victor Hooi
> wrote:
>> Hi,
>>
>> We're on Python 2.6 (RHEL based system...) - I don't believe this
>> exposes FileNotFoundError =(.
>
> Ah! I forgot about 2.x, sorry for the nose. Yep, catching OSError
On Mon, Oct 28, 2013 at 5:57 PM, Victor Hooi wrote:
> Hi,
>
> We're on Python 2.6 (RHEL based system...) - I don't believe this exposes
> FileNotFoundError =(.
Ah! I forgot about 2.x, sorry for the nose. Yep, catching OSError
would be the thing to do, then!
ChrisA
--
https://mail.python.org/ma
On Mon, Oct 28, 2013 at 6:01 PM, Chris Angelico wrote:
> Ah! I forgot about 2.x, sorry for the nose. Yep, catching OSError
> would be the thing to do, then!
A "nose", apparently, is what happens when your typing stinks. I meant
"noise", of course. :)
ChrisA
--
https://mail.python.org/mailman/li
Hi,
We're on Python 2.6 (RHEL based system...) - I don't believe this exposes
FileNotFoundError =(.
Cheers,
Victor
On Monday, 28 October 2013 17:36:05 UTC+11, Chris Angelico wrote:
> On Mon, Oct 28, 2013 at 2:43 PM, Victor Hooi wrote:
>
> > Is it acceptable to use try-except in order to achi
On Mon, Oct 28, 2013 at 2:43 PM, Victor Hooi wrote:
> Is it acceptable to use try-except in order to achieve this? E.g.:
>
> try:
> # Try to open up the SQLite file, and lookup the required entries
> except OSError:
> # Open an empty SQLite file, and create the schema
>
>
>
On Sun, 27 Oct 2013 20:43:07 -0700, Victor Hooi wrote:
> Hi,
>
> I'd like to double-check something regarding using try-except for
> controlling flow.
>
> I have a script that needs to lookup things in a SQLite database.
>
> If the SQLite database file doesn't exist, I'd like to create an empty
Hi,
I'd like to double-check something regarding using try-except for controlling
flow.
I have a script that needs to lookup things in a SQLite database.
If the SQLite database file doesn't exist, I'd like to create an empty
database, and then setup the schema.
Is it acceptable to use try-exc
10 matches
Mail list logo