python file can't import module after change pybind target name
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 670
- Forks
- 219
- Avg merge
- 8d 2h
- Merged PRs (30d)
- 1
Description
I move the test_basic.py to project root directory and change the import path.
Then, I change the target name in CMakeLists.txt and module name in test_basic.py.
Then, "mkdir build; cd build; cmake ...; make", and everything goes well.
However, when i run the test_basic.py, I get
"Traceback (most recent call last):
File "test_basic.py", line 2, in
import build.bind_example as m
ImportError: dynamic module does not define module export function (PyInit_bind_example)
".
Besides, when I change the target name back to cmake_example, the python file import module normally,
Attached files is the version which target name is changed.
CMakeLists.txt
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the attached CMakeLists.txt and test_basic.py, then reproduce the issue with the stated mkdir build; cd build; cmake ...; make steps. Compare the configured target name with the import used by test_basic.py and verify the module can be imported after the change; done means the reported ImportError no longer occurs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cmake, cpp, python
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100