[issue31056] Import Module Not Working According To Documentation Python 3.6.2

Brett Cannon report at bugs.python.org
Fri Jul 28 13:49:02 EDT 2017


Brett Cannon added the comment:

I also can't reproduce on Python 3.6 on Windows 10, so I'm closing this.

Looking at your SO question I noticed you didn't specify `python3` but `python` which suggests a venv, so I'm wondering if that's mucking with things? You also don't need to add __init__.py as long as you're executing within the directory (which it seems you are based on how you explained things). Basically you should be able to print out sys.path and see if the directory containing your code is listed there. If it isn't then something wonky is going on with your environment.

But if you are executing the code from outside the directory then do realize that Python 3 no longer supports implicit relative imports so module_a won't be picked up in a package context (that would require `from . import module_a`).

----------
nosy: +brett.cannon
resolution:  -> rejected
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue31056>
_______________________________________


More information about the Python-bugs-list mailing list