eblondel / zen4R

zen4R - R Interface to Zenodo REST API
https://github.com/eblondel/zen4R/wiki
Other
44 stars 14 forks source link

zenodo$uploadFile(path, myrec$id) returning atomic vector error #69

Closed nealhaddaway closed 2 years ago

nealhaddaway commented 2 years ago

AMAZING package! I've just run into a file upload problem.

When running the code zenodo$uploadFile(path, myrec$id) to upload a file to a record (that I know exists) I get the following error: 'Error in record$id : $ operator is invalid for atomic vectors'

myrec$id returns a real id, so I'm not sure what the problem is. I've already called 'zenodo' with: zenodo <- ZenodoManager$new( token = 'token', logger = "INFO" )

Almost certainly my fault, but I can't find a solution. Thank you so much!

eblondel commented 2 years ago

Is the record a deposit under edition, or a record already published with a DOI?

nealhaddaway commented 2 years ago

Thanks, Emmanuel. It's not yet published (so no DOI). I understood that I couldn't publish without uploading a file.


From: Emmanuel Blondel @.> Sent: 17 February 2022 09:51 To: eblondel/zen4R @.> Cc: nealhaddaway @.>; Author @.> Subject: Re: [eblondel/zen4R] zenodo$uploadFile(path, myrec$id) returning atomic vector error (Issue #69)

Is the record a deposit under edition, or a record already published with a DOI?

— Reply to this email directly, view it on GitHubhttps://github.com/eblondel/zen4R/issues/69#issuecomment-1042763503, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKOBNXCSHUVF3NLKLHZ2Z5TU3TAL5ANCNFSM5OSKSAHQ. You are receiving this because you authored the thread.Message ID: @.***>

eblondel commented 2 years ago

Ok I see now. You use zenodo$uploadFile(path, myrec$id) assuming myrec$id for the second argument. The latter should be an object of class ZenodoRecord and not the id. You should instead use zenodo$uploadFile(path, myrec) meaning zenodo$uploadFile(path, record = myrec). There is a legacy recordId in the function (as 3rd argument) but it's deprecated as it uses the old upload API. This should fix your issue, let me know

nealhaddaway commented 2 years ago

Ah perfect - thank you so much! Neal


From: Emmanuel Blondel @.> Sent: 17 February 2022 10:22 To: eblondel/zen4R @.> Cc: nealhaddaway @.>; Author @.> Subject: Re: [eblondel/zen4R] zenodo$uploadFile(path, myrec$id) returning atomic vector error (Issue #69)

Ok I see now. You use zenodo$uploadFile(path, myrec$id) assuming myrec$id for the second argument. The latter should be an object of class ZenodoRecord and not the id. You should instead use zenodo$uploadFile(path, myrec) meaning zenodo$uploadFile(path, record = myrec). There is a legacy recordId in the function (as 3rd argument) but it's deprecated as it uses the old upload API. This should fix your issue, let me know

— Reply to this email directly, view it on GitHubhttps://github.com/eblondel/zen4R/issues/69#issuecomment-1042792492, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKOBNXACHGD437XKUCCVUPLU3TD7NANCNFSM5OSKSAHQ. You are receiving this because you authored the thread.Message ID: @.***>

eblondel commented 2 years ago

you're welcome!