I work in Ubuntu16.04 x64 use python3.5 IDEA but I got a strange question as in picture,I try rename connect,but it can't work.
How should I solve this problem? Please tell me if you known,thinks.
I work in Ubuntu16.04 x64 use python3.5 IDEA but I got a strange question as in picture,I try rename connect,but it can't work.
How should I solve this problem? Please tell me if you known,thinks.
Try the following:
from .tpymysql import connect
I think there is something likeclass Connect()
in your connect.py
.
If the script to be executed is under the same path to connect.py
from connect import Connect
Else
from tpymysql.connect import Connect
The Pythonic way is making everything clear and specific. So when you want to import something, import what's inside other than the file itself.
Python3 usually throws this ImportError for relative imports. Seems relative imports are not necessary.
Try:
import tpymysql