My code:
from fin.py import *
from setup.py import *
My error:
Traceback (most recent call last):
File "<frozen importlib._bootstrap>", line 1519, in _find_and_load_unlocked
AttributeError: 'module' object has no attribute '__path__'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\name\Documents\Programming\snake.py", line 4, in <module>
from fin.py import *
ImportError: No module named 'fin.py'; fin is not a package
I am importing .py files from the same folder. Everything should work but this shows up!
EDIT: Solved! (Remove .py from the ending, I had tried this before but got a NameError due to a typo in my code. So yeah! Great!)
When you import you can omit the .py on the end of the files. What you're looking for is:
from fin import *
from setup import *
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.