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

Make PyIlmBase compatible with Python 3.x #224

Closed
sybrenstuvel opened this issue Feb 3, 2017 · 0 comments
Closed

Make PyIlmBase compatible with Python 3.x #224

sybrenstuvel opened this issue Feb 3, 2017 · 0 comments

Comments

@sybrenstuvel
Copy link

sybrenstuvel commented Feb 3, 2017

With Python 2 being phased out in the near future (within 3 years), it doesn't make sense for current software to be aiming only at Python 2. PyIlmBase should build on Python 3.x.

PYTHON=/usr/bin/python3.5 ./configure --with-boost-python-libname=libboost_python-py35 doesn't work on Ubuntu 16.10, and fails with this error:

...
checking for python version... 3.5
checking for python platform... linux
checking for python script directory... ${prefix}/lib/python3.5/site-packages
checking for python extension module directory... ${exec_prefix}/lib/python3.5/site-packages
  File "<string>", line 1
    from distutils.sysconfig import *; print get_python_inc()
                                                          ^
SyntaxError: invalid syntax
  File "<string>", line 1
    from distutils.sysconfig import *; print get_config_var("LIBDIR")
                                                          ^
SyntaxError: invalid syntax
checking for boost::python... no
*** Could not run the boost::python test program, checking why...
*** The test program could not be compiled.  Is boost::python installed?
*** Check that the cflags (below) includes the boost::python include directory
***
*** Flags used by the test:
***     cflags: -g -O2  -I -g -O2  -I 
***     ldflags:    -L    -L
***
*** You can also run configure with --disable-boostpythontest to skip this test.
configure: error: Could not compile boost::python test program.

Using print statements is not supported in Python 3 any more. Python 2 (2.6+) can even be told to use print() functions by including from __future__ import print_function at the top of the Python file.

@cary-ilm cary-ilm added the Feature Request A suggested change or addition of functionality to the library. label Jun 13, 2019
@cary-ilm cary-ilm added this to the Needs Attention milestone Jun 29, 2019
@cary-ilm cary-ilm added Python and removed Feature Request A suggested change or addition of functionality to the library. labels Jul 4, 2019
kdt3rd added a commit to kdt3rd/openexr that referenced this issue Jul 22, 2019
…pass under python3

Previously had fixed print functions, this pass converts the following:
- integer division changed in python3 3/2 -> 1.5, have to use 3//2 to
get an int
- xrange is no more, just use range
- integer type coersion for division not working, force type constructor

Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>
@kdt3rd kdt3rd closed this as completed in ab50d77 Jul 22, 2019
DominicJacksonBFX pushed a commit to boris-fx/mocha-openexr that referenced this issue Jun 22, 2022
…pass under python3

Previously had fixed print functions, this pass converts the following:
- integer division changed in python3 3/2 -> 1.5, have to use 3//2 to
get an int
- xrange is no more, just use range
- integer type coersion for division not working, force type constructor

Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>
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