Skip to content

ImportError: dynamic module does not define init function #144

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

Closed
msanders opened this issue Apr 29, 2018 · 1 comment
Closed

ImportError: dynamic module does not define init function #144

msanders opened this issue Apr 29, 2018 · 1 comment
Labels

Comments

@msanders
Copy link
Contributor

msanders commented Apr 29, 2018

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?

msanders added a commit to autopilot-rs/autopy that referenced this issue Apr 30, 2018
msanders added a commit to autopilot-rs/autopy that referenced this issue Apr 30, 2018
@konstin
Copy link
Member

konstin commented May 1, 2018

Yep, it's caused by rust-lang/rust#50120 and fixed in #147, which will be included in the next release.

@konstin konstin added the bug label May 5, 2018
@konstin konstin closed this as completed May 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants