Repository navigation
Credential issue and lexical error for invalid character in json text. #42
Description
Activity
does running
Sys.setenv("plotly_domain"="https://chart-studio.plotly.com")first resolve this issue?Updated comment above with correct domain name!
No, I'm still getting the same error. So I did some more work on it today. Plotly REST API, v2 at https://api.plotly.com/v2/?format=api requires a "platform name and an optional version". It lists the following as examples.
Plotly-Client-Platform: Lisp Plotly-Client-Platform: Python 0.2 Plotly-Client-Platform: Python 0.2.5 Plotly-Client-Platform: Python 3 0.3.2I remembered that I updated my version of R. The latest release for R was 2/29/20. So I went back to an old version and this wreaked a different kind of havoc on my code. Now, I'm back to the latest release of R. My code for R is now the following where "p" is a plot rendered with the plotly pkg:
Sys.setenv("USERNAME_PLOTLY" = "<username>") Sys.setenv("API_KEY_PLOTLY" = "<api_key>") Sys.setenv("PLOTLY_DOMAIN"="https://chart-studio.plotly.com") api_create(p)Still getting the same error . . .
Changed authentication to the following code. This was detailed in the plotly package documentation under "sign up" page 61:
# If you already have a username and API key, please create the following # environment variables: Sys.setenv("plotly_username" = "me") Sys.setenv("plotly_api_key" = "mykey") # You can also change the default domain if you have a plotly server. Sys.setenv("plotly_domain" = "http://mydomain.com")However, the original error was still present with a pointer to the
<html>code. The message said that there was an "invalid character in json text". The R program code commonly makes assignments with, for example,p <- 10. It was changed to "=". Also, the code relied on themagrittrpackage which uses "%>%" for piping. Switched it out for "+".It's working . . . Show the issue as closed!
I'm glad it's working for you! I'm confused about what you ended up changing that made it work, though, can you clarify please?
I thought the
fig <- fig %>% layoutwas somehow being interpreted as an html tag and throwing an error. I was able to push it once to plotly, but haven't been able to repeat it. Argh!
Can't push plot from R using
plot_ly::api_create(). Get the following error:In addition,
warnings()produces this console output:These are appearing in spite of me setting environment variables for username and api key. More odd, is that plotly accepted the plot once--not sure why.