[ 
https://issues.apache.org/jira/browse/PYLUCENE-62?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17491471#comment-17491471
 ] 

Andi Vajda edited comment on PYLUCENE-62 at 2/12/22, 11:34 PM:
---------------------------------------------------------------

It looks like finding the jvm.dll is an old problem on Windows and python 3.8 
just made it a bit worse. If you look in jcc3/__init__.py, which you modified 
in this patch, you can see that something similar is done when the 
--find-jvm-dll command line flag is set.
The code in jcc3/windows.py has something a bit more involved than just relying 
on JAVA_HOME to locate this DLL. I think you should update the 
add_jvm_dll_directory_to_path() to use the new python 3.8 add_dll_directory() 
function instead of its current messing with the Path environment variable. If 
you think of making --find-jvm-dll the default on Windows/python3.8, then the 
add_jvm_dll_directory_to_path() function in windows.py should verify that 
jvm.dll isn't already findable, before adding another DLL path if necessary.
Same issue with the changes in jcc3/python.py: you should not depend on 
JAVA_HOME but share the same logic in jcc3/windows.py (assuming that logic is 
still correct, of course).
In other words, does --find-jvm-dll work for you ? (without your patch).


was (Author: vajda):
It looks like finding the jvm.dll is an old problem on Windows and python 3.8 
just made it a bit worse. If you look in jcc3/__init__.py, which you modified 
in this patch, you can see that something similar is done when the 
--find-jvm-dll command line flag is set.
The code in jcc3/windows.py has something a bit more involved than just relying 
on JAVA_HOME to locale this DLL. I think you should update the 
add_jvm_dll_directory_to_path() to use the new python 3.8 add_dll_directory() 
function instead of its current messing with the Path environment variable. If 
you think of making --find-jvm-dll the default on Windows/python3.8, then the 
add_jvm_dll_directory_to_path() function in windows.py should verify that 
jvm.dll isn't already findable, before adding a DLL path if necessary.
Same issue with the changes in jcc3/python.py: you should not depend on 
JAVA_HOME but share the same logic in jcc3/windows.py (assuming that logic is 
still correct, of course).
In other words, does --find-jvm-dll work for you ? (without your patch).

> Not finding jvm.dll on windows
> ------------------------------
>
>                 Key: PYLUCENE-62
>                 URL: https://issues.apache.org/jira/browse/PYLUCENE-62
>             Project: PyLucene
>          Issue Type: Bug
>            Reporter: Petrus Hyvönen
>            Priority: Major
>         Attachments: add_dll_win.patch
>
>
> On recent versions of Python, the dll's seems to require to be added via the 
> os.add_dll_directory() function.
>  
> Apparently something changed in Python 3.8 regarding this, "Python 3.8 
> changed the DLL resolution order 
> [https://docs.python.org/3/whatsnew/3.8.html#bpo-36085-whatsnew]";
> Thanks to:
> [https://github.com/conda-forge/python-feedstock/issues/552]
>  
> Proposed fix in a patch below. It can likely be rewritten in some more neat 
> way. :)



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to