Skip to content

Spurious ImportWarnings on 3.6+ #1753

@seberg

Description

@seberg

Since I think it might be good to have an open issue for others to find. This is a resurrection of gh-1720.

Due to http://bugs.python.org/issue25791 on python 3.6 cython will cause warnings such as:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/antoine/multidict/multidict/__init__.py", line 24, in <module>
    __import__('_multidict', globals=globals(), level=1)
  File "multidict/_multidict.pyx", line 1, in init multidict._multidict (multidict/_multidict.c:14817)
    import sys
ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__

upon import. Getting rid of the warning appears to be not very easy, and probably requires gh-1715 to be implemented.

Workaround: If I understand correctly, if the cython module is compiled using cython -3 mode or uses from __future__ import absolute_import, most of these warnings should go away. Also python modules which are imported using the format of e.g. from . import _ufunc need to be converted to from scipy.special import _ufunc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions