Of course, assuming the program is running in the same directory with the database.
Of course, assuming the program is running in the same directory with the database.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You do not need to provide an absolute path to
open(), instead you can provide a relative path to the file you are opening from the current working directory.You can use this to eliminate the need for your
databasepathvariable, as long as the script is run from the same directory as the database (or always has the same relative path to the database).You may find the
os.getcwd()function useful for determining what the working directory of your script is.