Skip to content

Commit

Permalink
fix python3 issue for decoding str (it might come from an updated Cyt…
Browse files Browse the repository at this point in the history
…hon.). Closes #218
  • Loading branch information
tito committed Apr 18, 2016
1 parent 57c8461 commit ddcaa43
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions jnius/jnius_jvm_dlopen.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,15 @@ cdef void create_jnienv() except *:

JAVA_HOME = os.environ['JAVA_HOME']
if JAVA_HOME is None or JAVA_HOME == '':
raise SystemError("JAVA_HOME is not set.")
raise SystemError("JAVA_HOME is not set.")
IF JNIUS_PYTHON3:
lib_path = str_for_c(os.path.join(JAVA_HOME, JNIUS_LIB_SUFFIX.decode("utf-8")))
try:
jnius_lib_suffix = JNIUS_LIB_SUFFIX.decode("utf-8")
except AttributeError:
jnius_lib_suffix = JNIUS_LIB_SUFFIX
lib_path = str_for_c(os.path.join(JAVA_HOME, jnius_lib_suffix))
ELSE:
lib_path = str_for_c(os.path.join(JAVA_HOME, JNIUS_LIB_SUFFIX))
lib_path = str_for_c(os.path.join(JAVA_HOME, JNIUS_LIB_SUFFIX))

cdef void *handle = dlopen(lib_path, RTLD_NOW | RTLD_GLOBAL)
if handle == NULL:
Expand Down

0 comments on commit ddcaa43

Please sign in to comment.