panthomakos / timezone

Accurate current and historical timezones for Ruby with support for Geonames and Google latitude - longitude lookups.
http://rubygems.org/gems/timezone
MIT License
354 stars 49 forks source link

Timezone::Error::NilZone: No zone was found. Please specify a zone. #12

Closed auxbuss closed 12 years ago

auxbuss commented 12 years ago

I've been using timezone for ages and suddenly all my tests have failed after updating to 0.1.5. All is fine if I revert to 0.1.4

Taken from the README, when I do:

# encoding: utf-8
require 'timezone'
Timezone::Configure.begin do |c|
  c.username = 'xxxx'
end
timezone = Timezone::Zone.new :latlon => [-34.92771808058, 138.477041423321]
timezone.zone
timezone.time Time.now

I get:

/usr/local/rvm/gems/ruby-1.9.3-p194/gems/timezone-0.1.5/lib/timezone/zone.rb:33:in `initialize': No zone was found. Please specify a zone. (Timezone::Error::NilZone)

Any ideas? Thanks.

pedrofernandezm commented 12 years ago

Did you enable your account to use the web service? http://www.geonames.org/manageaccount

auxbuss commented 12 years ago

Yes. As I mentioned, all is well with v0.1.4. I've been using, and I continue to use, geonames daily.

Welcome blah.
You are now logged in and can update placenames. 
auxbuss commented 12 years ago

I had another look at this today. The problem was that the geonames API endpoint has changed from ws.geonames.org to api.geonames.org in the gem. My user name worked with the former url, and thus with timezone 0.1.4, but not with the latter. It turns out that the account needed to be re-enabled to use the changed url.

So @pedrofernandezm's suggestion was correct, but the account needed to be re-enabled rather than enabled.

EpicDraws commented 11 years ago

Does it take some period of time to enable the account? I still get this error even though my account is enabled. When I manually enter the URL in a browser with my username, things work fine.

auxbuss commented 11 years ago

I'm pretty sure account creation was immediate in my case.

bgetting commented 10 years ago

In case it helps someone, once you create your Geonames account you need to "enable web services" on it.

beNjiox commented 10 years ago

@bgetting, it helped someone, thanks a lot!

stephanschielke commented 10 years ago

@bgetting +1

r96941046 commented 10 years ago

For anyone encountering this problem: Timezone::Error::NilZone: No zone was found. Please specify a zone. Just refer to the comment by @bgetting above