【发布时间】:2015-02-16 20:42:52
【问题描述】:
我试图在我的 webapp 上安装 newrelic 的 python 代理,但我就是不能。我使用名为 code.py 的文件来启动我的应用程序。 我在乞讨时补充:
import newrelic.agent
newrelic.agent.initialize('newrelic.ini')
我也试过了:
import newrelic.agent
newrelic.agent.initialize('/root/web/newrelic.ini')
但我遇到了一些错误,例如
Traceback (most recent call last):
File "code.py", line 2, in <module>
import newrelic.agent
File "/usr/local/lib/python2.7/dist-packages/newrelic- 2.44.0.36/newrelic/agent.py", line 1, in <module>
from .config import initialize, extra_settings
File "/usr/local/lib/python2.7/dist-packages/newrelic-2.44.0.36/newrelic/config.py", line 34, in <module>
import newrelic.console
File "/usr/local/lib/python2.7/dist-packages/newrelic-2.44.0.36/newrelic/console.py", line 5, in <module>
import code
File "/root/web/code.py", line 3, in <module>
newrelic.agent.initialize('newrelic.ini')
AttributeError: 'module' object has no attribute 'agent'
有人可以帮忙吗?谢谢
【问题讨论】:
-
不要截图文本。将错误复制并粘贴到您的问题中。