This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jimli
Recipients docs@python, eric.smith, jimli
Date 2019-06-27.16:32:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1561653129.68.0.539305158022.issue37422@roundup.psfhosted.org>
In-reply-to
Content
Hi Eric,

Sorry for the late reply. I think I did not accurately describe the issue at all. As a minimal example, set up two virtual environments, one from 2.7.x, one from 3.7.2.

When you are in the virtual environment, do
- pip install protobuf==3.3.0
- python (to go into compiler)
- import google
- print(type(google.__path__))

The 2.7.x would tell you it's a <type 'list'>
The 3.7.2 would tell you it's a <class'_frozen_importlib_external._NamespacePath'>

Since it's not a list, some behaviours are gone, e.g., insert. I'm not trying to manipulate protobuf package's __path__, but trying to upgrade a legacy codebase, the legacy codebase does something like:

module.insert(0, 'some/path'), which breaks under python3, because it's not a list anymore, but a <class'_frozen_importlib_external._NamespacePath'>.


I believe the problem comes from the 'top level entry point'. For example, when you have 2 separate packages but they were organized under the same namespace.

E.g., in their setup.py

Package A:

    packages=[
        "orange",
        "orange.schemas",
    ],
    namespace_packages=["orange"]

Package B:
    packages=[
        "orange",
        "orange.server",
    ],
    namespace_packages=["orange"]

The problem comes from when you try to do `import orange`, and do operations with orange.__path__ here. In Python 2.7, it's a list; in Python 3.7, it's a <class '_frozen_importlib_external._NamespacePath'>
History
Date User Action Args
2019-06-27 16:32:09jimlisetrecipients: + jimli, eric.smith, docs@python
2019-06-27 16:32:09jimlisetmessageid: <1561653129.68.0.539305158022.issue37422@roundup.psfhosted.org>
2019-06-27 16:32:09jimlilinkissue37422 messages
2019-06-27 16:32:09jimlicreate