【发布时间】:2016-01-30 17:39:21
【问题描述】:
首先声明:我是第一次使用 python、anaconda 和 jupyter,所以它可能是一些基本的东西。 我从这个 url 将以下代码粘贴到一个新的 Jupyter 注释中: https://github.com/t0pep0/btc-e.api.python/blob/master/btceapi.py
填写我自己的 API 和 API 密钥后,我尝试运行它:
getInfo()
但是我遇到了这个错误:
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-14-c63c8cc1259c> in <module>()
96
97
---> 98 getInfo()
NameError: name 'getInfo' is not defined
我检查了以下解决方案:
- 先定义函数再运行,这个例子有效 在 Jupyter 中很好。 function is not defined error in Python
- 先定义类再运行函数,本例 在 Jupyter 中也可以正常工作。 Python NameError: name is not defined
但是由于类和函数在我复制的脚本中都以正确的顺序定义,所以肯定有其他事情发生。
【问题讨论】:
标签: python python-2.7 api jupyter jupyter-notebook