I'm using LightTable 0.6.6 and Python2.7.8 at Windows7 64bit. I got the error when I trying to import psycopg2 at Lighttable.
I wrote
> from psycopg2 import *
then Cmd-Enter,after I got those messages. The error shows that there is no connect, but the file that error said is another py.file.
Im not good at english,I thank you for reading it through.
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
C:\Users\user_name\Documents\000_working_directory\python_workspace\test07052.py in <module>()
----> 1 from psycopg2 import *
C:\Users\user_name\Documents\000_working_directory\python_workspace\psycopg2.pyc in <module>()
15
16 # コネクション作成
---> 17 conn = psycopg2.connect(
18 database='dbname',
19 user='user_name',
AttributeError: 'module' object has no attribute 'connect'
The problem is in the psycopg2.py file, it tries to use a connect()
function that cannot be found (missing import ?).
When you do from psycopg2 import *
, Python finds the psycopg2.pyc in the same directory file and executes the contents. But it fails to find the connect()
function. Maybe the filename should be different, not to confuse Python with the actual psycopg2
module ? Have you tried removing the .pyc file and trying again ?
Are you sure you are importing what you want ? If you import like so from psycopg2 import *
, you are importing all the psycopg2 functions into your module namespace.
Maybe there's some other issues in the psycopg2.py file