elixir-cldr / cldr

Elixir implementation of CLDR/ICU
Other
455 stars 34 forks source link

ex_cldr (ArgumentError) argument error :erlang.binary_to_atom([“feminine”], :utf8) #142

Closed gfgs58 closed 3 years ago

gfgs58 commented 3 years ago

After updating dependencies from ex_cldr 2.18.2 to 2.19, this error comes up:

$ iex -S mix Erlang/OTP 23 [erts-11.0.4] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe]

Compiling 30 files (.ex) Generating MyApp.Cldr for 3 locales named [“en”, “es”, “root”] with a default locale named “en”

== Compilation error in file lib/circles/cldr.ex == ** (ArgumentError) argument error :erlang.binary_to_atom([“feminine”], :utf8) (ex_cldr 2.19.0) lib/cldr/config/config.ex:2108: Cldr.Config.atomize_gender/1 (elixir 1.11.3) lib/enum.ex:1415: anonymous fn/3 in Enum.map/2 (stdlib 3.13.1) maps.erl:233: :maps.fold_1/3 (elixir 1.11.3) lib/enum.ex:2209: Enum.map/2 (ex_cldr 2.19.0) lib/cldr/config/config.ex:2104: Cldr.Config.atomize_gender/1 (ex_cldr 2.19.0) lib/cldr/config/config.ex:2096: anonymous fn/1 in Cldr.Config.group_units/1 (elixir 1.11.3) lib/enum.ex:1197: anonymous fn/4 in Enum.group_by/3 (elixir 1.11.3) lib/enum.ex:2193: Enum."-group_by/3-lists^foldl/2-0-"/3 (ex_cldr 2.19.0) lib/cldr/config/config.ex:2094: Cldr.Config.group_units/1 (ex_cldr 2.19.0) lib/cldr/config/config.ex:2069: anonymous fn/1 in Cldr.Config.structure_units/1 (elixir 1.11.3) lib/enum.ex:1415: anonymous fn/3 in Enum.map/2 (stdlib 3.13.1) maps.erl:233: :maps.fold_1/3 (elixir 1.11.3) lib/enum.ex:2209: Enum.map/2 (ex_cldr 2.19.0) lib/cldr/config/config.ex:2069: Cldr.Config.structure_units/1 (ex_cldr 2.19.0) lib/cldr/config/config.ex:1300: Cldr.Config.do_get_locale/3 (ex_cldr 2.19.0) lib/cldr/compiler_locale_cache.ex:73: Cldr.Locale.Cache.do_get_locale/2 (ex_cldr 2.19.0) lib/cldr/config/config.ex:1896: Cldr.Config.decimal_formats_for/2 (elixir 1.11.3) lib/enum.ex:1411: Enum."-map/2-lists^map/1-0-"/2 (elixir 1.11.3) lib/enum.ex:1411: Enum."-map/2-lists^map/1-0-"/2

kipcole9 commented 3 years ago

Thanks for the report and very sorry for the inconvenience. I recognise the source of the error - which is when CLDR changed some data formats for CLDR 38.1 (which is what ex_cldr 39 is based upon, and does I think have some small changes for the "es" locale).

However when I create a new app with 2.19.0 as a dependency I can't reproduce the error and my test suite is still passing.

  1. If you can, do mix deps.clean ex_cldr then mix deps.get and mix deps.compile on version 2.19.0?
  2. If that still fails, may I ask you to clone this test app and compile it to see if your results are different?

The test app is just ex_cldr and related packages with a copy of your backend. There is no executable code in the app which you can easily verify.

kipcole9 commented 3 years ago

The other thing I can't work out is that I cannot find the string ["feminine"] in either my repo master branch, or in the test app which downloads the locale files from GitHub.

As a thought, if you are able to search all the json files in your project for that string it might help.

gfgs58 commented 3 years ago

$ grep -l -R "feminine" . ./.elixir_ls/dialyzer_tmp/.elixir_ls/build/_test/lib/circles/ebin/Elixir.Circles.Cldr.Rbnf.Ordinal.beam ./.elixir_ls/dialyzer_tmp/.elixir_ls/build/_test/lib/circles/ebin/Elixir.Circles.Cldr.Rbnf.Spellout.beam ./.elixir_ls/build/_test/lib/circles/ebin/Elixir.Circles.Cldr.Rbnf.Ordinal.beam ./.elixir_ls/build/_test/lib/circles/ebin/Elixir.Circles.Cldr.Rbnf.Spellout.beam ./.elixir_ls/build/_test/lib/ex_cldr/priv/cldr/locales/es.json ./_build/dev/lib/circles/ebin/Elixir.Circles.Cldr.Rbnf.Ordinal.beam ./_build/dev/lib/circles/ebin/Elixir.Circles.Cldr.Rbnf.Spellout.beam ./_build/dev/lib/ex_cldr/priv/cldr/locales/es.json ./deps/ex_cldr_numbers/README.md ./deps/ex_cldr/priv/cldr/locales/es.json

gfgs58 commented 3 years ago

After:

1) mix.exs change back to {:ex_cldr, "~> 2.0"}, 2) mix deps.clean ex_cldr 3) mix deps.get 4) mix deps.update --all 5) mix deps.compile 6) iex -S mix Erlang/OTP 23 [erts-11.0.4] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe]

Interactive Elixir (1.11.3) - press Ctrl+C to exit (type h() ENTER for help) iex(1)>

No error!

kipcole9 commented 3 years ago

Thanks very much for the collaboration. I think the error was due to an incompatible locale file living in deps/ex_cldr/priv/locales/es.json. But how the invalid data got there I have no idea. Thats why I think mix deps.clean ex_cldr did the trick since in :dev, the locale files are stored in deps, not _build.

I will close this issue for now but please do reopen if you find that the issue reoccurs (or of course any other issue!).