Forums

New relic in pythonanywhere

Hi everyone,

I have no idea why my newrelic agent don't work! I installed the agent of according the especifications on new relic's site but when I run the command for start the agent raise an exception. Why? And pythonanywhere is not in the list of hosting server of new relic.

What's the exception you're seeing?

When I configure my WSGI file with new relic, for example:

import newrelic.agent 
newrelic.agent.initialize('newrelic.ini')

and after this I reload my application the error log show me that:

/usr/lib/python2.7/threading.py:1158: RuntimeWarning: tp_compare didn't return -1 or -2 for exception

and this

newrelic.api.exceptions.ConfigurationError: Unable to open configuration file newrelic.ini.

[edited by admin: formatting]

Hmm. I'm not sure about the first error. But the second is pretty clear. Your web app could be running in any directory, but when you initialise it you only specify a relative path. If you change the line

newrelic.agent.initialize('newrelic.ini')

...to have a full absolute path, for example:

newrelic.agent.initialize('/home/DSMiranda/newrelic.ini')

...then that will fix that problem, and it might start working. Give that a try and let us know if it works.

DSMiranda -- I'm curious if you got newrelic to connect to your application...I'm getting the same error.

For anyone who is having this issue, remember to put this in your WSGI file. It's working for me!

  • import newrelic.agent
  • newrelic.agent.initialize('/home/[yourprofile]/newrelic.ini')