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
Use of wrapper classes in ipython causes Java Exceptions #72
Comments
Cool idea. I am betting that the wrapper class should be translating the Java exception in this case into an AttributeError exception or similar and I'd bet that IPython is expecting to catch that and then do the repr. Also, repr should be calling a.toString() - right? A pull request for the change would be much appreciated. BTW. Maybe you want to do this instead of using make_instance 😉 :
|
Spot on - IPython is checking for a method that may exist, and is ready to catch AttributeError and fall back to other methods if it doesn't. |
Oh, regarding the
I think I'd like to keep the current repr behavior. |
I think it's a good idea to keep the extra info in the repr; without it you could easily think that was a native Python list. |
Fixes #72 prevent call to getField for random attributes
Running the following code in ipython leads to a java exception
I would hope that
a
on its own would call the repr method and show the array but instead it give a java exception:A user-defined class without ipython_display defined works as expected. I'm not sure where the problem lies but the ability to wrap Java classes in python in an interactive session is awesome and it would be worth getting it working nicely.
I've posted a parallel issue on ipython as I'm not sure where changes need making: ipython/ipython#9253
The text was updated successfully, but these errors were encountered: