2016-02-13 30 views
1

當使用圖表繪製圖表時,我收到一條錯誤消息。我的代碼讀取如下:Python Plotly登錄錯誤

import plotly as py 
py.tools.set_credentials_file(username='myaccount', api_key='myapikey') 

import plotly.plotly as py 
import plotly.tools as plotly_tools 
from plotly.graph_objs import * 

py.sign_in("myaccount", "mypassword") 

(Some code that is not related to this problem.) 

py.iplot(data, filename='apple stock moving average') 

的錯誤信息是:

Traceback (most recent call last):

File "", line 1, in py.iplot(data, filename='apple stock moving average')

File "C:\Anaconda3\lib\site-packages\plotly\plotly\plotly.py", line 151, in iplot url = plot(figure_or_data, **plot_options)

File "C:\Anaconda3\lib\site-packages\plotly\plotly\plotly.py", line 241, in plot res = _send_to_plotly(figure, **plot_options)

File "C:\Anaconda3\lib\site-packages\plotly\plotly\plotly.py", line 1404, in _send_to_plotly raise exceptions.PlotlyError(r['error'])

PlotlyError: Aw, snap! You tried to use our API as the user 'myaccount', but the supplied API key doesn't match our records. You can view your API key at plot.ly/settings.

You're most likely getting this message because your local credentials file isn't synced with the Plotly server you're communicating with.

Go to plot.ly//getting-started (e.g., plot.ly/python/getting-started) for more information.

Make sure that you're logged in as myaccount.

Need help? Please try searching Plotly's http://stackoverflow.com/questions/tagged/plotly'>Stack Overflow channel.

我覺得plotly是不正常我的本地機器上安裝,但無法弄清楚解決這個正確的方法。我使用的是來自Anaconda3的spyder,並在windows7下。

任何人都可以幫助我嗎?謝謝!

回答

1

您在登錄時使用myapikey,登錄時使用mypassword。在兩個地方都使用相同的變量。