Skip to content

ImportError: dynamic module does not define init function #144

@msanders

Description

@msanders

Hi, I'm seeing the following error when compiling modules on the latest nightly:

error[E0658]: paths of length greater than one in macro invocations are currently unstable
  --> src/lib.rs:50:3
   |
50 | #[py::modinit(_word_count)]
   |   ^^^^^^^^^^^
   |
   = help: add #![feature(proc_macro_path_invoc)] to the crate attributes to enable

Then once I fix that by adding the feature attribute, I get an error when importing e.g. python -c "import word_count" from https://github.com/PyO3/pyo3/tree/master/examples/word-count:

Python 2.7.14 (default, Apr  4 2018, 09:03:23) 
[GCC 4.2.1 Compatible Apple LLVM 9.1.0 (clang-902.0.39.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import word_count
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "word_count/__init__.py", line 4, in <module>
    from ._word_count import search, search_sequential
ImportError: dynamic module does not define init function (init_word_count)

Can repro by running:

cd examples/word-count
python setup.py develop
python -c "import word_count"

(happens on both Python 2 and 3)

Any ideas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions