-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stdlib packages import local packages from working dir instead of other stdlib packages #101210
Comments
When running interactively, an empty string is prepended to You can run in isolated mode (i.e. |
Thanks for the explanation and sorry for the duplicate (I tried searching but didn't find the other issues). Looking forward to the Thanks! |
Python adds the current working directory as the first entry to `sys.path` . In some python versions, this will lead stdlib libraries to import modules in the working directory instead of other stdlib modules (python/cpython#101210). In our case, the conflict is `types.py`. Because `types.py` contains a PublicAPI we don't want to just rename it without proper deprecation. Instead we fix the `sys.path` in `setup-dev.py` as this is the only location where the problem predictably comes up. Signed-off-by: Kai Fricke <kai@anyscale.com>
Bug report
Global packages (e.g.
enum
) try to import from local packages in the current working dir, even if a same-named stdlib package exists.For instance, if a
types.py
exists in the local directory,import enum
will fail:The correct package to import should be the stdlib
types.py
package, not the localtypes.py
.Your environment
The text was updated successfully, but these errors were encountered: