Isaiah Melendez
asked on
ImportError: No module named 'pypyodbc' - python 3.5.2
Hello Experts -
I am writing a python script to connect to a MSAccess database file and I keep getting an annoying error. Based on google search I found you need to install pypyodbc (which I did) and also call the import of the module. However, but, I still get an error.
I have provided the code and the error below:
Error:
I am writing a python script to connect to a MSAccess database file and I keep getting an annoying error. Based on google search I found you need to install pypyodbc (which I did) and also call the import of the module. However, but, I still get an error.
I have provided the code and the error below:
import pypyodbc as pyodbc
DBSource = 'C:\\Users\\Database\\Desktop\\GA005_test.mdb'
conn = pypyodbc.connect("Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=C:\\Users\\Database\\Desktop\\GA005_test.mdb;")
cursor = conn.cursor()
DBDest = 'C:\\Users\\Database\\Desktop\\ROWBlank.mdb'
conn2 = pypyodbc.connect("Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=C:\\Users\\Database\\Desktop\\ROWBlank.mdb;")
cursor2 = conn2.cursor()
SQL = """select *
FROM HRO;"""
for row in cursor.execute(SQL):
k = row.naam
print (k)
cursor2.execute("""insert into ROWBlank.mdb values (?)""", (k))
conn2.commit()
cursor.close()
conn.close()
cursor2.close()
conn2.close()
Error:
Traceback (most recent call last):
File "C:\Users\Database\Desktop\importoldtonew.py", line 1, in <module>
import pypyodbc as pyodbc
ImportError: No module named 'pypyodbc'
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for the pointer David. I researched this and found that I had to put it in the dir for python programs.
I clicked on File on IDLE and clicked open module. From there I typed one that I knew would come up "OS" and it should me the raw py file location: C:\Users\Database\AppData\ Local\Prog rams\Pytho n\Python35 -32\Lib.
I popped in the pypyodbc.py file in there and it worked. Thanks!
I clicked on File on IDLE and clicked open module. From there I typed one that I knew would come up "OS" and it should me the raw py file location: C:\Users\Database\AppData\
I popped in the pypyodbc.py file in there and it worked. Thanks!
ASKER
How can I verify this?