-
Notifications
You must be signed in to change notification settings - Fork 29
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
[Nuisance issue] Using Gnuplot prints correct graph, also throws error #321
Comments
I tried with Ruby 3.1 but could not reproduce the relevant error message.
|
I can confirm, the problem no longer exists when I use rvm to switch to Ruby3.0.0 Perhaps there is a difference in either error type handling (i.e. the error is caught in Ruby 3.0 but not 2.7), or some form of implicit conversion that turns it into a hash properly? Either way, using RVM to switch to Ruby 3.0 is acceptable for my use case, but it would be nice to either suppress these warnings for lower versions or add a short note to the documentation saying that there is a small issue with the lower ruby version. |
Ok, thanks. I did confirm that the error occurs in 2.7.6. |
I see an error when a Gnuplot class object is passed to "*args".
events.trigger(:post_run_cell, result) unless silent # result is_a Gnuplot object
def trigger(event, *args, **kwargs)
check_available_event(event)
@callbacks[event].each do |fn|
fn.call(*args, **kwargs)
end
end |
Maybe if I change it like this it will work. I'm not sure if this is enough. def trigger(*args, **kwargs)
event = args.shift
check_available_event(event)
@callbacks[event].each do |fn|
fn.call(*args, **kwargs)
end
end |
No, the above change does not solve the problem. |
Fixed. |
Thank you kindly for the fix! I have used Numo-narray before, and should look at the other tools that they offer. Have a lovely day ^^ |
Dear IRuby maintainer team,
I ran into a minor issue (annoyance, does not seem to actually impact functionality) with using Gnuplot.
The issue:
Gnuplot will correctly render the graph and insert output below the cell.
However, IRuby also throws an error below it. The kernel continues execution as normal and the graph remains, the only issue is the fact that the error message clutters output.
Reproduction:
Using the minimal gnuplot example as given in the example notebook:
Output:
Execution continues as normal after this.
Versions:
ruby 2.7.4p191 (2021-07-07 revision a21a3b7d23) [x86_64-linux-gnu]
5.4.1+dfsg1-1+deb11u1
No further output in the console running Jupyter was seen.
As such, this is mostly a nuisance issue, but can be confusing, as it is expected that the given minimal examples work without throwing errors.
Note that the error message IS correct.
Calling
to_hash
returns a key-value pair array.This might be a subtle version incompatibility between IRuby and the gnuplot gem that I am using. Perhaps a small check to convert the returned array ((which really should be a hash, why
to_hash
returns a key-value pair array is a mystery to me)) to a hash would already fix this.The returned array looks like this:
[[:set, "title", "\"Array Plot Example\""], [:set, "xlabel", "\"x\""], [:set, "ylabel", "\"x^2\""], [:set, "to_hash", ""]]
The text was updated successfully, but these errors were encountered: