On Tue, Apr 30, 2013 at 12:41 AM, Yarin <ykess...@gmail.com> wrote:
> Ricardo- yes, importing httplib2 throws the same error, even without
> importing oauth.
>
> We've noticed that the problem does not arise with the new relic import
> statment on the first line,
> but only on the second line, when the new relic agent is initialized.
>
> import newrelic.agent # Doesn't cause error when httplib2 imported later
> newrelic.agent.initialize('/opt/web-apps/web2py/newrelic.ini')# DOES cause
> error

I really don't know what is happen, just try to help you debug it...

Check if you spot any difference in sys.modules:

import newrelic.agent
import sys
print >>sys.stderr, sys.modules
newrelic.agent.initialize('/opt/web-apps/web2py/newrelic.ini')
print >>sys.stderr, sys.modules


Another option:

What happen when you do:

    sys.modules['httplib2'] =
sys.modules['applications.<you_app_name>.modules.httplib2']

before:

    import httplib2


Another options can be move httplib2 out of your app.modules


I dont know but It seems that newrelic installs some import hook
and do monkey patching that may be conflicting with web2py custom_import.
taken from http://pydoc.net/Python/newrelic/1.2.0.246/newrelic.config/:

# Register our importer which implements post import hooks for
# triggering of callbacks to monkey patch modules before import
# returns them to caller.

sys.meta_path.insert(0, newrelic.api.import_hook.ImportHookFinder())

Really don't know what is happening, maybe you could ask some support
with newrelic staff.

Ricardo

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to