The method error reported in _ _ init__.py introduced by python does not exist.

< H1 > question < / H1 >

introduce the contents of _ _ init__.py under the current directory into the script article.py to report an error ImportError: cannot import name "fake"

< H1 > path < / H1 >

test/

__init__.py
article.py

file _ _ init__.py

-sharp -*- coding:utf-8 -*-
def fake():
    print("A")

File article.py

-sharp -*- coding:utf-8 -*-
from . import fake
print(fake)

execute python article.py error prompt:

Traceback (most recent call last):
  File "article.py", line 2, in <module>
    from . import fake
ImportError: cannot import name "fake"

how to introduce the contents of _ _ init__.py in article.py

Apr.02,2021

try this

   

I hope it will be helpful to you.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b31896-2bd9c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b31896-2bd9c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?