fix: ensure data directory exists before init_db call (#65)#79
Open
aouwalitshikkha wants to merge 1 commit into
Open
fix: ensure data directory exists before init_db call (#65)#79aouwalitshikkha wants to merge 1 commit into
aouwalitshikkha wants to merge 1 commit into
Conversation
sqlite3.connect() fails with 'unable to open database file' on fresh installs where data/ directory does not exist. This happens with both Docker (bind mount creates ./data as root, container user can't write) and bare Python (no data/ directory at all). Fix ensures data/ exists before any database operation: - main.py: add os.makedirs before init_db() call - start-librecrawl.sh: mkdir -p data at script start - start-librecrawl.bat: mkdir data at script start Fixes PhialsBasement#65
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
sqlite3.connect()fails withunable to open database fileon fresh installs where thedata/directory does not exist. This happens with both Docker (bind mount creates./dataas root, container user can't write) and bare Python (nodata/directory at all).Reported in #65.
Fix
3 files changed, 5 insertions added — ensures
data/exists before any database operation:main.pyos.makedirs("data", exist_ok=True)beforeinit_db()callstart-librecrawl.shmkdir -p dataat script startstart-librecrawl.batif not exist data mkdir dataat script startos.makedirs()was already present insidesrc/auth_db.py'sinit_db(), but the directory must exist beforeinit_db()is reached. The startup scripts additionally ensure Docker bind mounts a pre-created directory with correct host-side permissions.Validation
git diff --stat: 3 files, 5 insertions, 0 deletions