2017-08-16 87 views

回答

0

与Plot.ly的问题是,它需要的凭据进行安装:

import plotly 
plotly.tools.set_credentials_file(username='SomeDemoAccount', api_key='SomeAPIKey') 

而这将不作为代码在控制台,因为实例不运行,而不是从SSH可以访问~/.plotly/.credentials文件,即它不能创建或访问它,所以任何对API的调用都将失败。在AWS日志,你会得到以下错误:

Looks like you don't have 'read-write' permission to your 'home' ('~') directory or to our '~/.plotly' directory. That means plotly's python api can't setup local configuration files. No problem though! You'll just have to sign-in using 'plotly.plotly.sign_in()'. For help with that: 'help(plotly.plotly.sign_in)'. 

所以解决的办法就是调用它甚至没有自己的入门指南,也不是API参考中提到的plotly.plotly.sign_in()方法,并且必须与以下参数调用:

plotly.plotly.sign_in("Your Plotly Username","Your Plotly API Key") 

那我实现了具有这些值作为EB环境属性:

plotly.plotly.sign_in(os.environ['YOUR_PLOTLY_USERNAME_ENV_PROPERTY_NAME'],os.environ['YOUR_PLOTLY_API_KEY_ENV_PROPERTY_NAME']) 
相关问题