Share via

error using jupter notebook

Michael Ashby 80 Reputation points
2026-03-05T19:52:35.1933333+00:00

not sure if this is in the right area

What is wrong with this line when using juypter notebook

conn = sqlite3.connect(C:\Users\aussi\OneDrive\Documents\Google Colab\SQL BDMs.rmgc)

which is where my database is stored

Any help appreciated

SQL Server | Other
0 comments No comments

Answer accepted by question author
  1. Q&A Assist
    2026-03-05T19:52:45.2+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    The issue is the way the Windows path string is written in Python.

    In Python, backslashes in strings are escape characters, so this:

    conn = sqlite3.connect(C:\Users\aussi\OneDrive\Documents\Google Colab\SQL BDMs.rmgc)
    

    will be parsed incorrectly and also lacks quotes around the path (it must be a string).

    Use one of these correct forms instead:

    1. Raw string literal:
    conn = sqlite3.connect(r"C:\Users\aussi\OneDrive\Documents\Google Colab\SQL BDMs.rmgc")
    
    1. Escape backslashes properly:
    conn = sqlite3.connect("C:\\Users\\aussi\\OneDrive\\Documents\\Google Colab\\SQL BDMs.rmgc")
    
    1. Use forward slashes (Python accepts them on Windows):
    conn = sqlite3.connect("C:/Users/aussi/OneDrive/Documents/Google Colab/SQL BDMs.rmgc")
    

    Also ensure that the file actually exists at that path and that OneDrive sync is not interfering. If running in a different environment (for example, a remote Jupyter server), that local Windows path will not be accessible and the database file must be on a path visible to the Jupyter runtime.


    References:

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.