Skip to content
This repository has been archived by the owner on May 31, 2020. It is now read-only.

import statement throws internal java.lang.ClassCastException #906

Open
patiences opened this issue Aug 13, 2018 · 2 comments
Open

import statement throws internal java.lang.ClassCastException #906

patiences opened this issue Aug 13, 2018 · 2 comments

Comments

@patiences
Copy link
Contributor

patiences commented Aug 13, 2018

from math import sqrt

sqrt(4)

throws this error:

java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at python.testdaemon.TestDaemon.main(TestDaemon.java:65)
Caused by: java.lang.ClassCastException: org.python.java.Module cannot be cast to org.python.Callable
	at python.test.module$import(test.py:3)
	at python.test.main(test.py)
	... 5 more

FAIL

You don't get this error if the program was instead:

from math import * 

sqrt(4)

Then you get a NameError.

@Kriyszig
Copy link

Kriyszig commented Dec 4, 2018

Isn't VOC relying on inter operation with Java for math library?
It's evident from the tutorial on their docs where they use from java.lang import Math to get access to random functions here

@freakboy3742
Copy link
Member

@VisibleMarkov Yes, VOC uses Java's internal libraries. That's not what is being reported here. The sample code provided by @patiences is legal Python; it should work when compiled by VOC.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants