You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to run this code on groovy kernel and its give a strange error.
import java.util.zip.ZipEntry
import java.util.zip.ZipFile
zipInputFile = new ZipFile(file)
list = entires.toList();
zipInputFile.getInputStream(list.get(0))
This is the exception it is giving. while running the same code works with normal execution of groovy script.
groovy.lang.MissingPropertyException: No such property: file for class: script1622875172283
at this cell line 3
at com.twosigma.beakerx.groovy.evaluator.GroovyCodeRunner.runScript(GroovyCodeRunner.java:94)
at com.twosigma.beakerx.groovy.evaluator.GroovyCodeRunner.call(GroovyCodeRunner.java:59)
at com.twosigma.beakerx.groovy.evaluator.GroovyCodeRunner.call(GroovyCodeRunner.java:32)
Later I found this is happening because this kernel don't share local variables across the cells. But it still share local variable declared at last line.
So if I write,
The zipInputFile will not get scoped to the next cell. Why is this inconsistency ?
The text was updated successfully, but these errors were encountered:
vrocky
changed the title
Error MissingPropertyException while running code through groovy kernel
Error MissingPropertyException because of inconsistent scoping of local variables through this groovy kernel
Jun 5, 2021
I am trying to run this code on groovy kernel and its give a strange error.
This is the exception it is giving. while running the same code works with normal execution of groovy script.
Later I found this is happening because this kernel don't share local variables across the cells. But it still share local variable declared at last line.
So if I write,
in a separate cell 'zipInputFile' will be scoped to next cell.
But when I declare variable mentioning its type. (both ways are valid in groovy)
The zipInputFile will not get scoped to the next cell. Why is this inconsistency ?
The text was updated successfully, but these errors were encountered: