Voronchuk/elixir_google_spreadsheets

** (File.Error) could not read file "./google/service_account.json": no such file or directory

Copser opened this issue · 4 comments

Hey, after I run all the configuration and played with the library, it just stoped working, so I'm using

elixir -v
Erlang/OTP 22 [erts-10.4.4] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [hipe] [dtrace]

Elixir 1.9.1 (compiled with Erlang/OTP 22)

I followed your README file for configuration, I have added this into my config.exs

config :goth, json: "./google/service_account.json" |> File.read!

config :elixir_google_spreadsheets, :client,
  request_workers: 50,
  max_demand: 100,
  max_interval: :timer.minutes(1),
  interval: 100

But now when I start iex -S mix all I got is

➜  twitter_feed git:(master) ✗ iex -S mix
Erlang/OTP 22 [erts-10.4.4] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [hipe] [dtrace]

** (File.Error) could not read file "./google/service_account.json": no such file or directory
    (elixir) lib/file.ex:353: File.read!/1
    (stdlib) erl_eval.erl:680: :erl_eval.do_apply/6
    (stdlib) erl_eval.erl:888: :erl_eval.expr_list/6
    (stdlib) erl_eval.erl:240: :erl_eval.expr/5
    (stdlib) erl_eval.erl:232: :erl_eval.expr/5
    (stdlib) erl_eval.erl:888: :erl_eval.expr_list/6
    (stdlib) erl_eval.erl:411: :erl_eval.expr/5
    (stdlib) erl_eval.erl:126: :erl_eval.exprs/5

the json is there in the folder and that path is fine, did you maybe encountered something similar? Thanks.

Hi @Copser,

It depends on where your google folder is located. In the readme, we use config folder so it's clear that this folder is in CWD for mix command.

I'd check if google is located in the same folder where you execute mix command. You can also just use an absolute path with File.cwd()

Hey @Voronchuk, ok so I've deleted google folder and I'm going with current setup

Screen Shot 2019-12-25 at 8 25 56 PM

You can see that service_account.json is in config folder so I have tried with

config :goth, json: "./config/service_account.json" |> File.read! and config :goth, json: "./service_account.json" |> File.read! and still no luck, I'll take a look at absolute path.

Thanks for the quick response.

@Copser, please try IO.inspect() with https://hexdocs.pm/elixir/Path.html#expand/1 and check if that file really exists. Answering your original question, I never had such issues, but will try to help with the investigation.

hey @Voronchuk I've made to spin it up by removing the pipe operator so it's

config :goth, json: File.read!("./config/service_account.json")

I'm not sure what happened, it's working now, thanks for your help, maybe if you can point out to some live example of usage to the app it would be great, thanks, I'll close this I have something else to ask.