[Tutor] Using module Facebook

Danny Yoo dyoo at hashcollision.org
Fri Jul 18 23:04:44 CEST 2014


>>>
>>> Now, there's another error message:
>>>
>>> (facebook)[chris at cd facebook]$ ./fb1.py
>>> Traceback (most recent call last):
>>>   File "./fb1.py", line 6, in <module>
>>>     import facebook
>>>   File
>>> "/home/chris/software/facebook/lib/python2.6/site-packages/facebook.py",
>>> line 811
>>>     args = {k: v for k, v in args.iteritems() if v is not None}
>>>                    ^
>>> SyntaxError: invalid syntax
>>>
>
> That' a dict comprehension and I am quite sure that those were introduced in Pyton 2.7. And you seem to be using v2.6


Yes, this unfortunately looks like the facebook-sdk folks are using
something that isn't in Python 2.6.  They say that their library
should be compatible with 2.6, according to:

    http://facebook-sdk.readthedocs.org/en/latest/install.html

but the dictionary comprehension used there is a Python 2.7 feature:

    https://docs.python.org/3.5/whatsnew/2.7.html#other-language-changes

And in this situation, you will want to send a ping to the
facebook-sdk folks: this is either considered a bug in the
documentation, or a bug in the implementation.  :P


More information about the Tutor mailing list