Skip to content
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

Error with modules built for Python 3.5 #1

Closed
aalavandhaann opened this issue Dec 29, 2017 · 2 comments
Closed

Error with modules built for Python 3.5 #1

aalavandhaann opened this issue Dec 29, 2017 · 2 comments

Comments

@aalavandhaann
Copy link

Dear saviours,

Firstly, I want to thank you for this wonderful library. Seems robust and should make the lives of plethora of python developers in our world a good one. I tried generating the library using the examples but with one tiny change in the Cmakelists.txt i.e., setting the version of python from 2.7 to 3.5

#set(PYBIND11_PYTHON_VERSION 2.7)
set(PYBIND11_PYTHON_VERSION 3.5)

The library was sucessfully built inside the build directory with the test_classes.py and test_functions.py contained in the same directory. When I run the examples as shown in the README.md

python3 test_classes.py

I get this error (not able to import the module)

Traceback (most recent call last):
  File "test_classes.py", line 2, in <module>
    import pyshapes.geometry
  File "/home/ashok/libraries/cppwg/build/pyshapes/geometry/__init__.py", line 2, in <module>
    from _pyshapes_geometry import *
ImportError: No module named '_pyshapes_geometry'

I checked if those modules are available and indeed the pyshapes directory can be seen with the subdirectories containing the relevant so files. I am using Ubuntu 16.04 with the GNOME flavor on an AMD machine.

Any ideas where this is going wrong?

Regards,

#0K

@aalavandhaann
Copy link
Author

Okay, after copying the so files and dropping them directly under the folder where test_functions.py and test_classes.py exist (directly under the build directly) the tests work okay

But it throws this warning

test_functions.py:10: DeprecationWarning: Please use assertTrue instead.
  self.failUnless(c == a + b)
.
----------------------------------------------------------------------
Ran 1 test in 0.000s

OK

Is this something to worry about?

Regards,

#0K

@jmsgrogan
Copy link
Collaborator

Hi, unfortunately I wasn't able to support this package when you had your questions. Python 3 wasn't supported or tested at the time, however it is enabled by default now. The ImportError is just due to a change in relative vs. absolute import behaviours between Python 2 and 3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants