Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kgl_datasets_download error. #1

Open
guifsdev opened this issue Oct 3, 2018 · 11 comments
Open

kgl_datasets_download error. #1

guifsdev opened this issue Oct 3, 2018 · 11 comments

Comments

@guifsdev
Copy link

guifsdev commented Oct 3, 2018

First of all, thank you for this amazing project!

I'm getting some issues when downloading a dataset from kaggle using the code bellow:

kgl_auth(creds_file = '~/.kaggle/kaggle.json')
kgl_auth()
data <- kgl_datasets_download(owner_dataset = "secareanualin/football-events", 
                               fileName = "events.csv")

I get the following error:

Error: lexical error: invalid char in json text.
                                       PK-
                     (right here) ------^

Any ideas?

@ejharrit
Copy link

When I try downloading .csv data using httr it looks like it doesn't come back in JSON format. Instead, it comes as "text/csv". I'll let you know if I figure out a way for it to return the result in a nicely formatted data frame.
sample_submission_unp <- GET("https://www.kaggle.com/api/v1/competitions/data/download/11000/sample_submission.csv", authenticate("ejharrit", kaggle_key, type = "basic"))
http_type(sample_submission_unp) [1] "text/csv"

@ejharrit
Copy link

using content with as ="parsed worked
content(sample_submission_unp, as = "parsed")

@luliudata
Copy link

Hey how did you install the package? I used:
install.packages('devtools')
library(devtools)

install_github('mkearney/kaggler')
13
library(kaggler)
and I got the error:
Error in library(kaggler) : there is no package called ‘kaggler’

@ejharrit
Copy link

@cecilialiu0803 If I remember correctly, I had to install all the packages in a numbered list it kept giving me before this package finally installed. If that doesn't work for you it might be worth starting a new issue for this or posting in the devtools::install_github() instead of install_packages() issue.

@luliudata
Copy link

@ejharrit Thank you so much!!!!! It works now.

@luliudata
Copy link

@ejharrit But how can I find my key, I cannot open the 'kaggle.json' file

@ejharrit
Copy link

@cecilialiu0803 you should be able to read it into r using
fromJSON("kaggle.json", flatten = TRUE) from the jsonlite package.
If that doesn't work you should also be able to right click the file and choose "open with" and select an app, like notepad, to open it and just read it manually.

@luliudata
Copy link

luliudata commented Feb 18, 2019 via email

@saicharanabhishek
Copy link

Has someone figured out the solution to gui-souza's question? I am getting the same error

@luliudata
Copy link

luliudata commented Mar 21, 2019 via email

@jlizardi
Copy link

First of all, thank you for this amazing project!

I'm getting some issues when downloading a dataset from kaggle using the code bellow:

kgl_auth(creds_file = '~/.kaggle/kaggle.json')
kgl_auth()
data <- kgl_datasets_download(owner_dataset = "secareanualin/football-events", 
                               fileName = "events.csv")

I get the following error:

Error: lexical error: invalid char in json text.
                                       PK-
                     (right here) ------^

Any ideas?

Same issue for me, any updates?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants