Giter VIP home page Giter VIP logo

beakerx_kernel_groovy's People

Contributors

efimovvladimir avatar fcollonval avatar ildipo avatar jaroslawmalekcodete avatar martinrenou avatar tanayparikh avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

beakerx_kernel_groovy's Issues

Error MissingPropertyException because of inconsistent scoping of local variables through this groovy kernel

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,

import java.util.zip.ZipEntry
import java.util.zip.ZipFile

String file = "C:\\Users\\user\\.gradle\\caches\\modules-2\\files-2.1\\org.apache.bcel\\bcel\\6.5.0\\79b1975ec0c7a6c1a15e19fb3a58cc4041b4aaea\\bcel-6.5.0.jar"
zipInputFile = new ZipFile(file);

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)

import java.util.zip.ZipEntry
import java.util.zip.ZipFile

String file = "C:\\Users\\user\\.gradle\\caches\\modules-2\\files-2.1\\org.apache.bcel\\bcel\\6.5.0\\79b1975ec0c7a6c1a15e19fb3a58cc4041b4aaea\\bcel-6.5.0.jar"
ZipFile zipInputFile = new ZipFile(file);

The zipInputFile will not get scoped to the next cell. Why is this inconsistency ?

TableDisplayLoadingMode.ENDLESS doesn't work

try the code on Groovy:

import java.util.function.Supplier
import java.util.stream.Stream
TableDisplay.setLoadingMode(TableDisplayLoadingMode.ENDLESS)
def generate = Stream.generate(new Supplier<Map<String, Object>>() {
    def random = new Random()
    def index = 0
    @Override
    Map<String, Object> get() {
        return [
            str1: index++,
            str2: random.nextDouble(),
            str3: random.nextFloat()
        ]
    }
    })
new TableDisplay(generate)

It will create table with limited count of rows

Expected result is endless table

How is the working directory set in Groovy script?

We have an implementation of a kernel based on this one that incorporates the Micronaut framework (https://github.com/stainlessai/micronaut-jupyter). When we switch kernels from Groovy, however, the working directory changes and I can't figure out why.

Using this kernel from any path in the jupyter context, e.g., $HOME/my/working/dir, the code:

println new File(".").absolutePath

returns

$HOME/my/working/dir

How does this path get passed to the Groovy script code for running the cell?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.