'Python cant find database if script is run from other file
I have this struggle with a dataheavy project. I can run a file that uses a query file -- Al the query's and converters are in here -- without problems, but when I run a file that runs that file again, I get an error that the db cant be found.
so:
Queryfile() : No problem,
Queryfile() -> Actionfile() : No problem,
Queryfile() -> Actionfile() -> action_manager(): Error, cant find db,
Queryfile() -> Actionfile() -> action_manager() -> startupfile(): Giant error, no way to solve it.
My goal is to build a startup file in the main dir and trigger all needed scripts from there, but I constantly receive this error:
(sqlite3.OperationalError) unable to open database file
(Background on this error at: https://sqlalche.me/e/14/e3q8)
('ERROR_LOADING_ANALYSES', OperationalError('(sqlite3.OperationalError) unable to open database file'))
This is really bad and I don't know what i need to to make this project run. If there is any alternative way, for example move the workdirectory to this file, run it and move back, I would like to know it. Please let me know how you are dealing with this.
this is my project tree.
├───core_data
│ ├───data_temp
│ ├───**DATABASE**
├───core_update
│ ├───update_main
│ │ └───__pycache__
│ ├───update_additional_scripts
│ │ └───__pycache__
├───core_utils
│ ├───database_querys
│ │ └───__pycache__
│ ├───database_tables
│ │ └───__pycache__
├───startup file
├───constants.
Look forward to your reply.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|