Python same directory import error

When using protobuf, we own a variety of Options when the references in the same directory files generated in python, so this time we can not do, add a __init__.py file in the file and then write something happens inside import mudole.filethis code because we can not control themselves

The solution, by adding the following code __init__ file:
`` `the Python
Import SYS
Import OS
sys.path.append (os.path.dirname ( 'mudole_name /'))

Guess you like

Origin www.cnblogs.com/daryl-blog/p/11002947.html