From eed13c1b587c292f86d4b302918418ce78637126 Mon Sep 17 00:00:00 2001 From: ache Date: Tue, 31 Aug 2021 08:21:42 +0200 Subject: Create a new database --- download/msgPack2sqlite_msgPack.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'download/msgPack2sqlite_msgPack.py') diff --git a/download/msgPack2sqlite_msgPack.py b/download/msgPack2sqlite_msgPack.py index 38d34cd..c08efdb 100644 --- a/download/msgPack2sqlite_msgPack.py +++ b/download/msgPack2sqlite_msgPack.py @@ -1,4 +1,5 @@ import msgpack +import os import sys import sqlite3 @@ -6,6 +7,12 @@ import argparse def writeDB(outputF, data): + # Delete if exists + try: + os.remove(outputF) + except OSError: + pass + with sqlite3.connect(outputF) as con: cur = con.cursor() cur.execute('''CREATE TABLE IF NOT EXISTS entry ( -- cgit v1.2.3-54-g00ecf