Connecting Anaconda with Access Database using Pyodbc

  • Thread starter WWGD
  • Start date
  • #1
WWGD
Science Advisor
Gold Member
2019 Award
5,319
3,140

Summary:

Trying to connect Anaconda with Access Db using Pyodbc , getting 'EOL String

Main Question or Discussion Point

Hi All,
My goal is to access an Access Database from within Anaconda Jupyter and , in Jupyter, use Pyodbc to conduct dynamic queries against my database and do some plotting of the data in Access. My code is below, together with the error message



--------------------------------------------------------------------------------------

1579657834845.png



Error message is:
File "<ipython-input-6-eabb548dc75e>", line 3
conn = pyodbc.connect(r'Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ ="C:\AccessDbFiles\BillsPyodbc.accdb")
^
SyntaxError: EOL while scanning string literal

-----------------------------------------------------------------------------
Any ideas?
 

Answers and Replies

  • #2
11,827
5,450
I notice the close paren is red maybe you are missing a single quote character.

r’blah blah “blah” ‘
 
  • Like
Likes WWGD
  • #3
WWGD
Science Advisor
Gold Member
2019 Award
5,319
3,140
I notice the close paren is red maybe you are missing a single quote character.

r’blah blah “blah” ‘
Thanks, will check out tmw, just left coffee shop.
 
  • Like
Likes jedishrfu
  • #4
Borg
Science Advisor
Gold Member
1,876
2,312
Untitled47? How do you remember where anything is?
 
  • #5
WWGD
Science Advisor
Gold Member
2019 Award
5,319
3,140
Untitled47? How do you remember where anything is?
I have my own system until I learn. Maybe not the best but somehow works.
 
  • #6
11,827
5,450
A real programmer lets the computer tell them where they are.
 
  • #7
WWGD
Science Advisor
Gold Member
2019 Award
5,319
3,140
A real programmer lets the computer tell them where they are.
?? Not sure I get it.
 
  • #8
11,827
5,450
Have you ever used the pwd command in linux? or the date or time commands? or even better the uname -a command?

Each of these commands tells you something about where you are or when you are or what machine you're on and there are many others that tell things you might need to know.
 
  • #9
33,646
5,315
Untitled47? How do you remember where anything is?
I have my own system until I learn. Maybe not the best but somehow works.
Definitely not the best, and I doubt it would work over a longer time span than a week or two.
If you take a small amount of time now to come up with names for your programs and variables (recalling another thread of yours) that are indicative of what they will do, it will really pay dividends when you are looking for examples of specific techniques or are trying to understand what your code is doing when you or others look at it a month or more later.
Each of these commands tells you something about where you are or when you are or what machine you're on and there are many others that tell things you might need to know.
Borg's comment wasn't about where the programmer was, but was instead a comment on using uninformative program names such as Untitled47.
 
  • #10
11,827
5,450
Thanks @Mark44 but I was responding to @WWGD who asked about my real programmer humor while awaiting if the single quote was the issue in his code which I think it was.
 
  • #11
33,646
5,315
Thanks @Mark44 but I was responding to @WWGD who asked about my real programmer humor while awaiting if the single quote was the issue in his code which I think it was.
It wasn't clear that your reply referred back to what WWGD said. In the interim, Borg asked "How do you remember where anything is?" -- so your comment seemed to me to be a non sequitur.
 
  • Like
Likes jedishrfu
  • #12
pbuk
Science Advisor
Gold Member
1,457
437
I notice the close paren is red maybe you are missing a single quote character.

r’blah blah “blah” ‘
SyntaxError: EOL while scanning string literal
makes this a cast iron certainty - the parser is telling you that it reached the end of the line before it reached the end of the string!

Somtimes error messages are not very helpful, but you should always read them in case they are :rolleyes:
 
  • Like
Likes WWGD, Timo and jedishrfu
  • #13
WWGD
Science Advisor
Gold Member
2019 Award
5,319
3,140
  • #14
11,827
5,450
Thanks, that brought back nightmares of projects long ago using DB2 and related hardware/software issues of broken connections.
 
  • #15
WWGD
Science Advisor
Gold Member
2019 Award
5,319
3,140
Thanks, that brought back nightmares of projects long ago using DB2 and related hardware/software issues of broken connections.
In case it helps, I am having a few of my own, with nightmares about odbc drivers.
 
  • Like
Likes jedishrfu
  • #16
WWGD
Science Advisor
Gold Member
2019 Award
5,319
3,140
It seems that Computus, ruler of IT world, granted me the miracle of conecting through named pipes to use sqlcmd. A complete blur; I have no clue how it came to happen.
 
  • Like
Likes pbuk

Related Threads on Connecting Anaconda with Access Database using Pyodbc

  • Last Post
Replies
3
Views
2K
Replies
0
Views
2K
Replies
1
Views
1K
Replies
3
Views
2K
Replies
1
Views
5K
  • Last Post
Replies
6
Views
2K
Replies
7
Views
2K
Top