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

Using IRuby.input or IRuby.form hangs Kernel #320

Open
Xasin opened this issue Jun 25, 2022 · 5 comments
Open

Using IRuby.input or IRuby.form hangs Kernel #320

Xasin opened this issue Jun 25, 2022 · 5 comments

Comments

@Xasin
Copy link

Xasin commented Jun 25, 2022

Hello everyone!

I am having a problem using the IRuby Jupyter kernel on my laptop.
The problem:
Immediately after using the IRuby.input or IRuby.form command, the actual form does not render properly.
A warning is also shown:
image

In addition to this, the Kernel now hangs until restarted. Clicking "done" has no effect.
Hitting enter on the form panels causes the browser to reload the website.

The same warning is shown when using IRuby.input, and the behaviour on hitting enter is the same.

It appears that the JS Snippet responsible for registering the form submission fails to execute properly.

Please note that the python3 input function works perfectly fine.
I tested this in Chromium and Firefox, same behaviour in both browsers.

I installed it according to the recommended installation methods given on this GitHub page.
Versions:

  • ruby 2.7.4p191 (2021-07-07 revision a21a3b7d23) [x86_64-linux-gnu]
  • Python 3.9.2
  • Jupyter Lab Version 3.4.3

I had to manually install the erector gem as it seems to be a missing dependency when installing the iruby gem.

I would love to be able to use this for some of my own work, but having an input panel would be incredibly helpful, if not outright part of the base capabilities that I expect from this.
I hope this issue can be resolved quickly.

Kind regards,
Xasin

EDIT:
I initially thought the kernel hangs, but it seems it really is just waiting on the message of the Jupyter Notebook to come back.
As the form can never be submitted, the kernel then hangs at this cell indefinitely, but it CAN be interrupted, and if the statement is wrapped within a Timeout.timeout, it does abort execution after the timeout.

Still - having inputs would be very, very useful.

@kojix2
Copy link
Member

kojix2 commented Jun 26, 2022

Hello.

@kylekyle
Do you have any idea about this issue?

@Xasin
Copy link
Author

Xasin commented Jun 26, 2022

I just noticed that this problem only occurs in jupyter lab

If I do the same within a Jupyter notebook on the same machine and same versions, it works fine.

Maybe the Jupyter lab deprecated a JavaScript function to access the last executed cell, which would prevent a JS script from accessing the input forms of the last cell and add the onSubmit handlers.

I would prefer to use Jupyter Lab, as the interactive ruby shell and the ability to drag and drop cells between shell and notebook would be nice.

@niebaopeng
Copy link

I try to use IRuby.input
first I encounter the erector error, then I install it.
After that,
"NameError: uninitialized class variable @@schemes in URI" is here
Python 3.10.2 (main, Mar 13 2022, 09:07:14) [GCC 10.2.1 20210110]
IRuby 0.7.4 (with ffirzmq session adapter)
jupyter notebook classic 6.4.8-0d94979

@topofocus
Copy link
Contributor

topofocus commented Nov 9, 2023

Confirmed. The Error is still there.

NameError: uninitialized class variable @@schemes in URI
/usr/share/rvm/gems/ruby-3.2.0/gems/data_uri-0.1.0/lib/data_uri/uri.rb:64:in `<module:URI>'
/usr/share/rvm/gems/ruby-3.2.0/gems/data_uri-0.1.0/lib/data_uri/uri.rb:1:in `<top (required)>'
/usr/share/rvm/gems/ruby-3.2.0/gems/data_uri-0.1.0/lib/data_uri.rb:5:in `require'
/usr/share/rvm/gems/ruby-3.2.0/gems/data_uri-0.1.0/lib/data_uri.rb:5:in `<top (required)>'
/usr/share/rvm/gems/ruby-3.2.0/gems/iruby-0.7.4/lib/iruby/input/file.rb:1:in `require'
/usr/share/rvm/gems/ruby-3.2.0/gems/iruby-0.7.4/lib/iruby/input/file.rb:1:in `<top (required)>'
/usr/share/rvm/gems/ruby-3.2.0/gems/iruby-0.7.4/lib/iruby/input/autoload.rb:19:in `require'
/usr/share/rvm/gems/ruby-3.2.0/gems/iruby-0.7.4/lib/iruby/input/autoload.rb:19:in `<top (required)>'
/usr/share/rvm/gems/ruby-3.2.0/gems/iruby-0.7.4/lib/iruby/input.rb:18:in `require'
/usr/share/rvm/gems/ruby-3.2.0/gems/iruby-0.7.4/lib/iruby/input.rb:18:in `form'
(irb):in `<top (required)>'

Anybody with a hint to fix it?

@ashgkwd
Copy link

ashgkwd commented May 16, 2024

This error can be fixed in the data_uri gem by merging this PR dball/data_uri#15

I tried modifying the codes of the data_uri gem locally and the changes mentioned in the above PR fixes this issue. Either @dball can merge this PR OR @SciRuby needs to use well maintained gem instead of data_uri

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

5 participants