You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 4 DB in Python/SQLite Demo/vinventory.py
+5-4Lines changed: 5 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -8,11 +8,12 @@
8
8
fromsqlite3importError
9
9
importdatetime
10
10
#if you code is not connecting to the DB, uncomment the next three lines and read the comments. Also, you may need \ instead of / before the DB file name in windows
11
-
#import os
12
-
#path_root = os.path.dirname(os.path.abspath(__file__)) #grab the file system path to the current script file
13
-
#database_file_path = str(path_root)+"/myinventory.db" #construct the path to the database file (only necessary if the current working directory is not the same as the folder where this Python file is located.)
11
+
importos
12
+
path_root=os.path.dirname(os.path.abspath(__file__)) #grab the file system path to the current script file
13
+
print("Here is the PATH_ROOT",path_root)
14
+
database_file_path=str(path_root)+"/myinventory.db"#construct the path to the database file (only necessary if the current working directory is not the same as the folder where this Python file is located.)
14
15
#if you uncomment the three lines above, be sure to comment out this next line
15
-
database_file_path="myinventory.db"
16
+
#database_file_path = "myinventory.db"
16
17
defcreate_connection(db_file):
17
18
""" create a database connection to the SQLite database
0 commit comments