Note that there are some explanatory texts on larger screens.

plurals
  1. POself.user.user_id in the sample FB app throwing error
    primarykey
    data
    text
    <p>My FB app code had broken after a Facebook <a href="https://developers.facebook.com/roadmap/" rel="nofollow noreferrer">October 2012 Breaking Change</a> and it got fixed by following a suggestion here: <a href="https://stackoverflow.com/questions/11810397/picture-property-format-using-run-with-friends-fb-app">Picture property format using run with friends fb app</a></p> <p>But interestingly, after fixing it, I am facing another issue in the same code (which I dont think existed earlier) I have searched through the <a href="https://developers.facebook.com/roadmap/" rel="nofollow noreferrer">Breaking Changes</a> but this issue doesnt seem to be discussed there as well. Its complaining of user_id not being an attribute of self.user in this line: <code>u'userIdOnServer': self.user.user_id if self.user else None</code>. I have searched through forums etc. but couldnt find a clue.</p> <p>Here's the error:</p> <p>C:\Program Files\Google\google_appengine\google\appengine\ext\webapp\util.py in run_bare_wsgi_app(application=)</p> <pre><code> 114 env["wsgi.multithread"] = False 115 env["wsgi.multiprocess"] = False =&gt; 116 result = application(env, _start_response) 117 if result is not None: 118 for data in result: result undefined, application = &lt;google.appengine.ext.webapp._webapp25.WSGIApplication object&gt;, env = {'APPENGINE_RUNTIME': 'python', 'APPLICATION_ID': 'dev~app', 'AUTH_DOMAIN': 'gmail.com', 'CONTENT_LENGTH': '-1', 'CONTENT_TYPE': 'application/x-www-form-urlencoded', 'CURRENT_VERSION_ID': '1.1', 'GATEWAY_INTERFACE': 'CGI/1.1', 'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3', 'HTTP_ACCEPT_LANGUAGE': 'en-US,en;q=0.8', ...}, global _start_response = &lt;function _start_response&gt; C:\Program Files\Google\google_appengine\google\appengine\ext\webapp\_webapp25.py in __call__(self=&lt;google.appengine.ext.webapp._webapp25.WSGIApplication object&gt;, environ={'APPENGINE_RUNTIME': 'python', 'APPLICATION_ID': 'dev~app', 'AUTH_DOMAIN': 'gmail.com', 'CONTENT_LENGTH': '-1', 'CONTENT_TYPE': 'application/x-www-form-urlencoded', 'CURRENT_VERSION_ID': '1.1', 'GATEWAY_INTERFACE': 'CGI/1.1', 'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3', 'HTTP_ACCEPT_LANGUAGE': 'en-US,en;q=0.8', ...}, start_response=&lt;function _start_response&gt;) 715 handler.error(501) 716 except Exception, e: =&gt; 717 handler.handle_exception(e, self.__debug) 718 else: 719 response.set_status(404) handler = &lt;__main__.RecentRunsHandler object&gt;, handler.handle_exception = &lt;bound method RecentRunsHandler.handle_exception of &lt;__main__.RecentRunsHandler object&gt;&gt;, e = AttributeError("**'dict' object has no attribute 'friends'",)**, self = &lt;google.appengine.ext.webapp._webapp25.WSGIApplication object&gt;, self.__debug undefined C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\ROOT\app\main.py in handle_exception(self=&lt;__main__.RecentRunsHandler object&gt;, ex=AttributeError("'dict' object has no attribute 'friends'",), debug_mode=True) 228 self.log_exception(ex) 229 self.render(u'error', =&gt; 230 trace=traceback.format_exc(), debug_mode=debug_mode) 231 232 def log_exception(self, ex): trace undefined, global traceback = &lt;module 'traceback' from 'C:\Python27\lib\traceback.pyc'&gt;, traceback.format_exc = &lt;function format_exc&gt;, debug_mode = True C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\ROOT\app\main.py in render(self=&lt;__main__.RecentRunsHandler object&gt;, name=u'error', **data={'debug_mode': True, 'trace': 'Traceback (most recent call last):\n File "C:\\Pr...eError: \'dict\' object has no attribute \'friends\'\n'}) 265 u'appId': conf.FACEBOOK_APP_ID, 266 u'canvasName': conf.FACEBOOK_CANVAS_NAME, =&gt; 267 u'userIdOnServer': self.user.user_id if self.user else None, 268 }) 269 data[u'logged_in_user'] = self.user self = &lt;__main__.RecentRunsHandler object&gt;, self.user = {u'id': u'100003906996287', u'name': u'Sudhir Jain'}, self.user.user_id undefined, builtin None = None **&lt;type 'exceptions.AttributeError'&gt;: 'dict' object has no attribute 'user_id' args = ("'dict' object has no attribute 'user_id'",) message = "'dict' object has no attribute 'user_id'"** </code></pre> <p><strong>And here's the rendering code (I am building off of runwithfriends sample app):</strong></p> <pre><code>def render(self, name, **data): """Render a template""" if not data: data = {} data[u'js_conf'] = json.dumps({ u'appId': conf.FACEBOOK_APP_ID, u'canvasName': conf.FACEBOOK_CANVAS_NAME, u'userIdOnServer': self.user.user_id if self.user else None, }) data[u'logged_in_user'] = self.user data[u'message'] = self.get_message() data[u'csrf_token'] = self.csrf_token data[u'canvas_name'] = conf.FACEBOOK_CANVAS_NAME self.response.out.write(template.render( os.path.join( os.path.dirname(__file__), 'templates', name + '.html'), data)) </code></pre> <p>Sorry, if I missed providing any information but I would be glad to provide other info/error logs that you suggest. Thanks in advance.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload