Comments (11)
You need to execute Application.ensure_all_started(:timex)
in your migrations, the problem is that the :tzdata
application is not running, and so that ETS table is missing. This doesn't happen when you run iex -S mix
because Mix is starting :tzdata
from tzdata.
Thanks @lau. I made the same mistake too.
from tzdata.
Hi @bitwalker Did you put :tzdata in the applications list?
from tzdata.
Ah I still had it just in :included_applications
. Sorry about that!
from tzdata.
No worries. Also keep in mind that users of Timex will have to have their app start Tzdata if it is ~> 0.5.1. For instance
by adding :tzdata to the applications: list in their mix.exs file. This is not required for ~> 0.1.7, but it won't hurt to add it.
That's why I added this to the Calendar readme. Maybe you want to add that (or something similar) too:
Also add tzdata
to the list of applications in the mix.exs file:
def application do
[applications: [:logger, :tzdata]]
end
from tzdata.
Hey,
I'm getting the same error when trying to use Tzdata 0.5.12
(e.g. Tzdata.canonical_zone_list
) in a module attribute. It is present in the applications list. Taken from the getting started guide:
Any functions may be called when defining a module attribute.
Any idea what the issue might be?
from tzdata.
Hi @thisismydesign
Please update to the newest version of Tzdata (currently 0.5.16
).
Which version of Elixir are you using? Tzdata needs to be started somehow. In certain versions of Elixir Tzdata (or a library using it, such as Calendar), needs to be in the applications
list.
from tzdata.
@lau thanks for the quick reply!
0.5.16
behaves the same way. I'm using Tzdata natively and it's already in the applications list.
Elixir version:
Erlang/OTP 20 [erts-9.0] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]
Elixir 1.4.5
from tzdata.
My usage is like this:
defmodule Module do
@timezones Tzdata.canonical_zone_list
from tzdata.
I am also getting the same, with a different call.
I have this piece of code:
case Timex.Timezone.get(data) do
{:error, _} = error ->
error
data ->
{:ok, data}
end
to put timezones that are saved in the database into a struct.
Well when running a migration that gets some data through an Ecto Query I get this error:
** (ArgumentError) argument error
(stdlib) :ets.lookup(:tzdata_current_release, :release_version)
lib/tzdata/release_reader.ex:47: Tzdata.ReleaseReader.current_release_from_table/0
lib/tzdata/release_reader.ex:14: Tzdata.ReleaseReader.simple_lookup/1
lib/tzdata/release_reader.ex:7: Tzdata.ReleaseReader.zone_and_link_list/0
lib/tzdata.ex:40: Tzdata.zone_exists?/1
lib/timezone/timezone.ex:152: Timex.Timezone.name_of/1
lib/timezone/timezone.ex:180: Timex.Timezone.get/2
lib/common/ecto/timezone.ex:27: Common.Ecto.Timezone.load/1
(ecto) lib/ecto/type.ex:661: Ecto.Type.process_loaders/3
(ecto) lib/ecto/schema.ex:1490: Ecto.Schema.load!/5
(ecto) lib/ecto/schema.ex:1442: Ecto.Schema.safe_load_zip/4
(ecto) lib/ecto/schema.ex:1443: Ecto.Schema.safe_load_zip/4
(ecto) lib/ecto/schema.ex:1430: Ecto.Schema.__safe_load__/6
(ecto) lib/ecto/repo/queryable.ex:282: Ecto.Repo.Queryable.process_source/6
(ecto) lib/ecto/repo/queryable.ex:170: Ecto.Repo.Queryable.preprocess/5
(postgrex) lib/postgrex/query.ex:77: DBConnection.Query.Postgrex.Query.decode_map/3
(postgrex) lib/postgrex/query.ex:64: DBConnection.Query.Postgrex.Query.decode/3
(db_connection) lib/db_connection.ex:1019: DBConnection.decode/6
(ecto) lib/ecto/adapters/postgres/connection.ex:73: Ecto.Adapters.Postgres.Connection.prepare_execute/5
(ecto) lib/ecto/adapters/sql.ex:256: Ecto.Adapters.SQL.sql_call/6
Which has that code in the stack trace and doing some Inspects can verify that that's indeed the call that triggers the error, although doing:
iex(1)> Timex.Timezone.get("America/Los_Angeles")
#<TimezoneInfo(America/Los_Angeles - PDT (-07:00:00))>
What's interesting is that if I run the same code iex -S mix
works.
(Running 0.5.16
and
Erlang/OTP 20 [erts-9.2.1] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10] [hipe] [kernel-poll:false]
Elixir 1.6.1 (compiled with OTP 20)
)
from tzdata.
Makes sense @bitwalker, thanks!
from tzdata.
Related Issues (20)
- Erlang 23 HTTPC support - update Hackney to ~> 1.16 HOT 2
- IANA data does not seem to be correctly parsed for America/Whitehorse (Canada/Yukon) and America/Dawson HOT 5
- Compiler warnings on Elixir 1.11.0
- Possible to force HTTP client Hackney
- Invalid gap for the first naive datetime in the gap range
- tzdata_current_release raise an argument error
- Method to convert an alias to a canonical zone? HOT 1
- Dropping hackney dependency HOT 10
- Tzdata 2.0 plans HOT 4
- GenServer Tzdata.EtsHolder terminating when update HOT 9
- GenServer :tzdata_release_updater terminating HOT 8
- (FunctionClauseError) no function clause matching in Keyword.delete_key/3 HOT 3
- Configurable download_url HOT 2
- Tzdata.ReleaseUpdater argument error HOT 3
- Argument Error on :ets.lookup in ReleaseReader
- UndefinedFunctionError or wrong gap when date-time hits exactly the start of a gap HOT 1
- Tzdata polling for update HOT 9
- Function to list possible offsets for a time zone HOT 1
- Question: why were the functions related to `zone1970.tab` data removed (module `TableData`)? HOT 4
- Ability to download fresh tz release during build HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tzdata.