Merge branch 'master' into 'master'
Update Print Statement Updated Print statement to newer version of python which requires () around the statement. See merge request !1
Showing
1 changed file
with
4 additions
and
4 deletions
... | @@ -38,8 +38,8 @@ parser.add_argument('-s', '--sourcexml', required=True, help="Source XML Directo | ... | @@ -38,8 +38,8 @@ parser.add_argument('-s', '--sourcexml', required=True, help="Source XML Directo |
38 | parser.add_argument('-o', '--outputdb', required=True, help="Destination SQLite Database") | 38 | parser.add_argument('-o', '--outputdb', required=True, help="Destination SQLite Database") |
39 | args = parser.parse_args() | 39 | args = parser.parse_args() |
40 | 40 | ||
41 | print "Source XML Directory: %s" % (args.sourcexml,) | 41 | print ("Source XML Directory: %s" % (args.sourcexml,)) |
42 | print "Destination SQLite DB: %s" % (args.outputdb,) | 42 | print ("Destination SQLite DB: %s" % (args.outputdb,)) |
43 | 43 | ||
44 | conn = sqlite3.connect(args.outputdb) | 44 | conn = sqlite3.connect(args.outputdb) |
45 | c = conn.cursor() | 45 | c = conn.cursor() |
... | @@ -49,13 +49,13 @@ for filename in os.listdir(args.sourcexml): | ... | @@ -49,13 +49,13 @@ for filename in os.listdir(args.sourcexml): |
49 | try: | 49 | try: |
50 | fields = (', '.join('"' + item + '"' for item in field_list[filename])) | 50 | fields = (', '.join('"' + item + '"' for item in field_list[filename])) |
51 | query = "CREATE TABLE \"%s\" (%s)" % (filename, fields) | 51 | query = "CREATE TABLE \"%s\" (%s)" % (filename, fields) |
52 | print query | 52 | #print (query) |
53 | c.execute(query) | 53 | c.execute(query) |
54 | conn.commit() | 54 | conn.commit() |
55 | except sqlite3.OperationalError: | 55 | except sqlite3.OperationalError: |
56 | pass | 56 | pass |
57 | source_file = os.path.join(args.sourcexml, filename) | 57 | source_file = os.path.join(args.sourcexml, filename) |
58 | print "Parsing File: %s" % (source_file,) | 58 | print ("Parsing File: %s" % (source_file,)) |
59 | doc = untangle.parse(source_file) | 59 | doc = untangle.parse(source_file) |
60 | for item in doc.thing_list.thing: | 60 | for item in doc.thing_list.thing: |
61 | row = [] | 61 | row = [] | ... | ... |
-
Please register or sign in to post a comment