Dependency on Python version and default encoding (Bug #3854)
Description
Dependency on Python version¶
I have Python 2.7.8 (the latest Python 2 release version) and Python 3.4.1 (the latest Python 3 release version) installed on my computer.
The "modules\matlab\CMakeLists.txt
" file is using the "${PYTHON_DEFAULT_EXECUTABLE}
" variable (which is initialized with "${PYTHON2_EXECUTABLE}
" in "cmake\OpenCVDetectPython.cmake
") to launch the scripts "gen_matlab.py
" and "cvmex.py
" which are using the "lstrip_blocks
" parameter which seems not available in Python 2.7.8 :
jtemplate = Environment(loader=FileSystemLoader(template_dir), trim_blocks=True, lstrip_blocks=True)
If the "${PYTHON_DEFAULT_EXECUTABLE}
" variable is replaced by the "${PYTHON3_EXECUTABLE}
" variable, the error disappears.
Dependency on unicode¶
I am working on a 64 bits OS. On such an OS, the default encoding used by Python is unicode.
=> in the "modules\java\generator\rst_parser.py
" script, I have had to add the encoding to the open function:
df = open(doc, "rt" , encoding="utf_8")
a parameter which is not compatible with Python2...
Default Python executable¶
Since the default Python executable is not only used in the Matlab binding module, i have chosen to write an issue instead of a PR...
Associated revisions
Merge pull request #3854 from Dmitry-Me:reduceVariableScope8
History
Updated by Maksim Shabunin over 9 years ago
Issue has been transferred to GitHub: https://github.com/Itseez/opencv/issues/4811