Conversation
| @@ -1 +1,4 @@ | |||
| from booster import Booster, EigenVectorsOfHessianImage, computeEigenVectorsOfHessianImage, computeIntegralImage, ROICoordinates | |||
| # for python 2.0 compatibility | |||
| from __future__ import absolute_import as _ai | |||
| # IF(NOT (${PYTHON_MAJOR_VERSION} EQUAL 2)) | ||
| # MESSAGE(FATAL_ERROR "Python bindings require Python 2.x.") | ||
| # ENDIF() | ||
| #ENDIF() |
There was a problem hiding this comment.
I guess this can just be dropped, right?
| # OUTPUT_VARIABLE PYTHON_LIBRARY_NAME OUTPUT_STRIP_TRAILING_WHITESPACE) | ||
| # FIND_LIBRARY(PYTHON_LIBRARIES ${PYTHON_LIBRARY_NAME} HINTS "${PYTHON_PREFIX}" | ||
| # PATH_SUFFIXES lib lib64 libs DOC "Python libraries") | ||
| #ENDIF() |
There was a problem hiding this comment.
Should add that while I haven't built this package before, I have had some rough experiences with CMake finding the right Python. If this works, great, but it might be worth checking with others who added this to verify it still works.
|
|
||
| from exceptions import RuntimeError | ||
| if sys.version_info[0] < 3: | ||
| from exceptions import RuntimeError |
There was a problem hiding this comment.
Does this even need to be imported at all? FWICT this is already available on Python 2.7 and 2.6 without importing.
There was a problem hiding this comment.
Also might be worth adding from __future__ import print_function here as well.
|
|
||
| # load data | ||
| print "--- Loading data ---" | ||
| print("--- Loading data ---") |
There was a problem hiding this comment.
Might be worth adding from __future__ import print_function as the first line above to make sure this behavior is maintained even on Python 2.
|
Thanks both for the comments and PR. I haven't tried this yet, but is it now working with both python 2 and python 3? |
This came up as part of the work on the conda package for iiboost. It imports fine on python3, but I was not able to test that it really works because the tests cannot be run as they rely on data pickled on python2 that apparently cannot be loaded from python3.