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

SyntaxError: rrd.rb:47 during require #2

Closed
rizzah opened this issue Apr 13, 2010 · 13 comments
Closed

SyntaxError: rrd.rb:47 during require #2

rizzah opened this issue Apr 13, 2010 · 13 comments
Labels

Comments

@rizzah
Copy link

rizzah commented Apr 13, 2010

Looks like there is an issue with the rrd.rb file when you try to require it.

require 'rrd.rb'
SyntaxError: rrd.rb:47: , unexpected ','
from rrd.rb:3
from rrd.rb:3:in `require'
from (irb):3

@morellon
Copy link
Owner

Which version of ruby are you using?
Which version of rrd-ffi are you using?

I've tested here from source and it seems to work on ruby 1.8.7 and 1.9.2.preview.

@rizzah
Copy link
Author

rizzah commented Apr 13, 2010

jruby 1.4.0 (ruby 1.8.7 patchlevel 174)
rrd-ffi 0.2.2 throws it, rrd-ffi 0.2.1 does not

@morellon
Copy link
Owner

thanks rizzah, i will take a look at it with jruby

@rizzah
Copy link
Author

rizzah commented Apr 14, 2010

Cool, thanks. Its definitely something within the block for rrd.rb and the wrapper.rb as well. For instance I commented the block out in the rrd.rb, then received the same error in the wrapper.rb.

@morellon
Copy link
Owner

rizzah, could you please test it from the source here. i added a small fix and now it seems to work on jruby as well. Can you confirm please?
I'm not very proud of this solution though. It will figure how to solve it in a more fancy way later :)

Thanks for the feedback!

@rizzah
Copy link
Author

rizzah commented Apr 14, 2010

That got it to load. Seeing a new issue when calling functions out of it...

rrd_file = "/tmp/_opt.rrd"
@graph = RRD.graph :start => Time.now - 1.day, :end => Time.now do
  for_rrd_data "usage", :usage => :last, :from => rrd_file
  print_value "usage", :format => "%3.2lf%%"
end

NoMethodError (undefined method reduce' for {:start=>1271178593, :end=>1271264993, :title=>""}:Hash): gems/gems/rrd-ffi-0.2.2/lib/rrd/graph.rb:85:insave'
gems/gems/rrd-ffi-0.2.2/lib/rrd.rb:17:in `graph'

@morellon
Copy link
Owner

In my environment the tests did pass. I made some changes, removing the reduce method. Can i have your help again?

@rizzah
Copy link
Author

rizzah commented Apr 14, 2010

Sure, got this...

TypeError (can't convert Hash into String):
file:lib/jruby-stdlib-1.3.1.jar!/ffi/memorypointer.rb:9:in from_string' gems/gems/rrd-ffi-0.2.2/lib/rrd/wrapper.rb:314:into_pointer'
gems/gems/rrd-ffi-0.2.2/lib/rrd/wrapper.rb:314:in each' gems/gems/rrd-ffi-0.2.2/lib/rrd/wrapper.rb:314:into_pointer'
gems/gems/rrd-ffi-0.2.2/lib/rrd/wrapper.rb:148:in graph' gems/gems/rrd-ffi-0.2.2/lib/rrd/graph.rb:89:insave'
gems/gems/rrd-ffi-0.2.2/lib/rrd.rb:17:in `graph'

for what its worth i just changed the reduce methods to inject, which is essentially the same method, received the same error

@morellon
Copy link
Owner

Try the latest changes from source, to see if it works.

I removed the reduce method, using only each_pair method now.

@rizzah
Copy link
Author

rizzah commented Apr 14, 2010

TypeError (can't convert Hash into String):
file:lib/jruby-stdlib-1.3.1.jar!/ffi/memorypointer.rb:9:in from_string' gems/gems/rrd-ffi-0.2.2/lib/rrd/wrapper.rb:314:into_pointer'
gems/gems/rrd-ffi-0.2.2/lib/rrd/wrapper.rb:314:in each' gems/gems/rrd-ffi-0.2.2/lib/rrd/wrapper.rb:314:into_pointer'
gems/gems/rrd-ffi-0.2.2/lib/rrd/wrapper.rb:148:in graph' gems/gems/rrd-ffi-0.2.2/lib/rrd/graph.rb:89:insave'
gems/gems/rrd-ffi-0.2.2/lib/rrd.rb:17:in `graph'

@morellon
Copy link
Owner

Graph using jruby is working for me. I can't reproduce this error.
I saw you are using "lib/jruby-stdlib-1.3.1.jar", may it be jruby version 1.3 instead of 1.4?

I tested using jruby 1.4.0 from rvm.

@rizzah
Copy link
Author

rizzah commented Apr 14, 2010

hm yup..got it to work. Thanks for the assistance.

@rizzah
Copy link
Author

rizzah commented Apr 14, 2010

close

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants