mkearney / kaggler

🏁 API client for Kaggle
https://github.com/mkearney/kaggler
Other
58 stars 14 forks source link

kgl_datasets_download error. #1

Open guifsdev opened 5 years ago

guifsdev commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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

luliudata commented 5 years ago

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 commented 5 years ago

@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 commented 5 years ago

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

luliudata commented 5 years ago

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

ejharrit commented 5 years ago

@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 commented 5 years ago

Thanks Eddy, I’ll have a try.

Get Outlook for iOShttps://aka.ms/o0ukef


From: Eddy notifications@github.com Sent: Monday, February 18, 2019 21:53 To: mkearney/kaggler Cc: Lu Liu [mm18ll]; Mention Subject: Re: [mkearney/kaggler] kgl_datasets_download error. (#1)

@cecilialiu0803https://github.com/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.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/mkearney/kaggler/issues/1#issuecomment-464893971, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AqGK2TfFFVQxSRWTeMlLMo4Oj4wV9floks5vOyDlgaJpZM4XF2Ct.

saicharanabhishek commented 5 years ago

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

luliudata commented 5 years ago

Hi, I haven’t checked this course for a while, will have a look this weekend, what’s the question you are asking


From: saicharanabhishek notifications@github.com Sent: Thursday, March 21, 2019 01:45 To: mkearney/kaggler Cc: Lu Liu [mm18ll]; Mention Subject: Re: [mkearney/kaggler] kgl_datasets_download error. (#1)

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

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/mkearney/kaggler/issues/1#issuecomment-475089159, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AqGK2bHbxojVlB5Xu13MaI6UYwSVTqVkks5vYuRKgaJpZM4XF2Ct.

jlizardi commented 4 years ago

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?