Giter Club home page Giter Club logo

Comments (8)

niktexnik avatar niktexnik commented on June 12, 2024

I tried different versions, last version was tried too, but error present again

from ip2location-ruby.

ip2location avatar ip2location commented on June 12, 2024

Hi @niktexnik, we are sorry that this library does not support Rails.

from ip2location-ruby.

niktexnik avatar niktexnik commented on June 12, 2024

When I have ruby 2.4.1 it's working, it's crashed after update ruby to 3.3.0....
But it's the same thing, it's the Ruby framework.
Ok, when I use Ruby, I have same problem.
irb(main):002> Ip2location.new.open("~/IP2LOCATION-LITE-DB1.BIN").get_all('8.8.8.8')
/home/niktexnik/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/ip2location_ruby-8.0.3/lib/ip2location_ruby/i2l_string_data.rb:8:in read_and_return_value': undefined method tell' for nil (NoMethodError)

old_offset = file.tell
                 ^^^^^
    from /home/niktexnik/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/bindata-2.5.0/lib/bindata/base_primitive.rb:124:in `do_read'
    from /home/niktexnik/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/bindata-2.5.0/lib/bindata/struct.rb:141:in `block in do_read'
    from /home/niktexnik/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/bindata-2.5.0/lib/bindata/struct.rb:141:in `each'
    from /home/niktexnik/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/bindata-2.5.0/lib/bindata/struct.rb:141:in `do_read'
    from /home/niktexnik/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/bindata-2.5.0/lib/bindata/base.rb:149:in `block in read'
    from /home/niktexnik/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/bindata-2.5.0/lib/bindata/base.rb:243:in `start_read'
    from /home/niktexnik/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/bindata-2.5.0/lib/bindata/base.rb:147:in `read'
    from /home/niktexnik/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/bindata-2.5.0/lib/bindata/base.rb:21:in `read'
    from /home/niktexnik/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/ip2location_ruby-8.0.3/lib/ip2location_ruby.rb:167:in `bsearch'
    from /home/niktexnik/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/ip2location_ruby-8.0.3/lib/ip2location_ruby.rb:53:in `get_all'
    from (irb):2:in `<main>'
    from <internal:kernel>:187:in `loop'
    from /home/niktexnik/.gem/ruby/3.3.0/gems/irb-1.12.0/exe/irb:9:in `<top (required)>'
    from /home/niktexnik/.rbenv/versions/3.3.0/bin/irb:25:in `load'
    from /home/niktexnik/.rbenv/versions/3.3.0/bin/irb:25:in `<main>'

image

from ip2location-ruby.

niktexnik avatar niktexnik commented on June 12, 2024

image
when I open file, all OK

image
after use different methods, error

from ip2location-ruby.

ip2location avatar ip2location commented on June 12, 2024

We noticed you are using the older version of the library. Kindly update the library to the latest version and try again. You can use the command gem update ip2location_ruby to update the library.

from ip2location-ruby.

niktexnik avatar niktexnik commented on June 12, 2024

I tried different versions, example(using last version your gem)

irb(main):001> require 'ip2location_ruby'
=> true
irb(main):002> z = Ip2location.new.open("~/IP2LOCATION-LITE-DB1.BIN")
=>
#<Ip2location:0x00007f45997715b0
...
irb(main):003> z.get_country_short('8.8.8.8')
/home/niktexnik/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/ip2location_ruby-8.7.2/lib/ip2location_ruby/i2l_string_data.rb:8:in read_and_return_value': undefined method tell' for nil (NoMethodError)

old_offset = file.tell
                 ^^^^^
    from /home/niktexnik/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/bindata-2.5.0/lib/bindata/base_primitive.rb:124:in `do_read'
    from /home/niktexnik/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/bindata-2.5.0/lib/bindata/struct.rb:141:in `block in do_read'
    from /home/niktexnik/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/bindata-2.5.0/lib/bindata/struct.rb:141:in `each'
    from /home/niktexnik/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/bindata-2.5.0/lib/bindata/struct.rb:141:in `do_read'
    from /home/niktexnik/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/bindata-2.5.0/lib/bindata/base.rb:149:in `block in read'
    from /home/niktexnik/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/bindata-2.5.0/lib/bindata/base.rb:243:in `start_read'
    from /home/niktexnik/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/bindata-2.5.0/lib/bindata/base.rb:147:in `read'
    from /home/niktexnik/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/bindata-2.5.0/lib/bindata/base.rb:21:in `read'
    from /home/niktexnik/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/ip2location_ruby-8.7.2/lib/ip2location_ruby.rb:690:in `bsearch'
    from /home/niktexnik/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/ip2location_ruby-8.7.2/lib/ip2location_ruby.rb:112:in `get_record'
    from /home/niktexnik/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/ip2location_ruby-8.7.2/lib/ip2location_ruby.rb:260:in `get_country_short'
    from (irb):3:in `<main>'
    from <internal:kernel>:187:in `loop'
    from /home/niktexnik/.gem/ruby/3.3.0/gems/irb-1.12.0/exe/irb:9:in `<top (required)>'
    from /home/niktexnik/.rbenv/versions/3.3.0/bin/irb:25:in `load'
    from /home/niktexnik/.rbenv/versions/3.3.0/bin/irb:25:in `<main>'

irb(main):004>

from ip2location-ruby.

ip2location avatar ip2location commented on June 12, 2024

We have fixed the error. Kindly update the library to the latest version and try again.

from ip2location-ruby.

niktexnik avatar niktexnik commented on June 12, 2024

it's work! Thanks!

from ip2location-ruby.

Related Issues (3)

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.