Skip to content
This repository was archived by the owner on Feb 20, 2024. It is now read-only.

Commit 52ab2db

Browse files
committed
Switch SQLLite Vinventory Demo file path
enabled the more specific file path in this demo.
1 parent ac17357 commit 52ab2db

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

4 DB in Python/SQLite Demo/vinventory.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@
88
from sqlite3 import Error
99
import datetime
1010
#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+
import os
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.)
1415
#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"
1617
def create_connection(db_file):
1718
""" create a database connection to the SQLite database
1819
specified by the db_file

0 commit comments

Comments
 (0)