Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AssertionError When GAE Is Installed But Not Used #46

Open
bdoms opened this issue Apr 16, 2010 · 0 comments
Open

AssertionError When GAE Is Installed But Not Used #46

bdoms opened this issue Apr 16, 2010 · 0 comments

Comments

@bdoms
Copy link

bdoms commented Apr 16, 2010

In the situation where you have GAE accessible on your system's path, but it is not actually being used (e.g. you're currently developing a Pylons project that doesn't use GAE) there is a problem when using the urlread function, which is defined near the top of pyfacebook.py.

Because GAE is on the system, line 79 ("from google.appengine.api import urlfetch") does not raise an import error, so the GAE version of the urlread function is used. However, when it is invoked in this situation it raises an AssertionError with this explanation: 'No api proxy found for service "urlfetch"'. This is probably caused by the fact that GAE isn't actually running in this case.

The quickest fix is just to except this error and use the default behavior:

91c91,92
<         result = urlfetch.fetch(url, method=method,

---
>         try:
>             result = urlfetch.fetch(url, method=method,
92a94,96
>         except AssertionError:
>             res = urllib2.urlopen(url, data=data)
>             return res.read()

There's probably a better, long-term fix for this problem though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant