Of course, assuming the program is running in the same directory with the database.
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
databasepath variable, 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.