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

JPype get_default_jvm_path #452

Closed
mattomatic opened this issue May 28, 2019 · 3 comments
Closed

JPype get_default_jvm_path #452

mattomatic opened this issue May 28, 2019 · 3 comments

Comments

@mattomatic
Copy link

mattomatic commented May 28, 2019

I think that the way the trunk looks now we can no longer run:

import jpype

path = jpype.get_default_jvm_path()

As it now results in this:

AttributeError: module 'jpype' has no attribute 'get_default_jvm_path'

In 0.6.3 this was runnable and documented, but since #334 the jpype/_core.py all has been refactored so that get_default_jvm_path is not exported by default.

Was this deliberate to move away from get_default_jvm_path -- should we add it back to all to preserve backwards compatibility?

Current:

__all__ = [
    'isJVMStarted', 'startJVM', 'attachToJVM', 'shutdownJVM',
    'getDefaultJVMPath', 'getJVMVersion', 'isThreadAttachedToJVM', 'attachThreadToJVM',
    'detachThreadFromJVM'
]

Modified???

__all__ = [
    'isJVMStarted', 'startJVM', 'attachToJVM', 'shutdownJVM',
    'getDefaultJVMPath', 'getJVMVersion', 'isThreadAttachedToJVM', 'attachThreadToJVM',
    'detachThreadFromJVM','get_default_jvm_path'
]
@Thrameos
Copy link
Contributor

Thrameos commented May 28, 2019 via email

@Thrameos
Copy link
Contributor

The symbols was removed as part of the symbol clean up where all symbols that were not intending to be imported on from jpype import * where killed. I suppose we can still have the symbol existing in jpype without appearing in the module export list, though that would also break compatibility with users that imported all symbols.

After the patch I get this result.

$ python3 -Wd test2.py
test2.py:3: DeprecationWarning: jpype._core.get_default_jvm_path is deprecated, use getDefaultJVMPath instead
  path = jpype.get_default_jvm_path()

Note that string behavior and JException are different between JPype 0.6.3 and 0.7.0. Strings require manual requests to convert to python and the layer of the tree wrapping exceptions were dropped.

BTW thanks for testing with the new code. Please report any issues.

@mattomatic
Copy link
Author

Cool, happy for this to have deprecated warning for the next release. I've already updated the code to no longer use that method, but when I first ran into the issue it was not clear to me if it was accidentally or purposefully removed.

Thrameos added a commit that referenced this issue May 29, 2019
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