I am trying to run a basic example with the Facebook SDK for Python. I tried doing exactly what this tutorial does from the command line (with "pip install facebook
" and "pip install facebook-sdk
" successfully done first...):
import Facebook
works okay, but graph = facebook.GraphAPI()
gives the following error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'GraphAPI'
I'm not imtimately familiar with how modules work, but it looks like facebook
somehow isn't recognized at all! Or something else is missing here. From the command line, I tried these things to investigate:
>>>dir(facebook)
Output:
['__builtins__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__version__']
and...
>>>help(facebook)
Output:
Help on package facebook:
NAME
facebook - TODO: Document your package.
FILE
/Library/Python/2.7/site-packages/Facebook-0.0-py2.7.egg/facebook/__init__.py
PACKAGE CONTENTS
DATA
__loader__ = <zipimporter object "/Library/Python/2.7/site-packages/Fa...
__version__ = 'TODO: Enter a version'
VERSION
TODO: Enter a version
(END)
...But I'm still stuck. Do I need to "enter a version" to somehow get the thing to fully instantiate? Or could it be something else?
If you are using Ubuntu or Debian, Just execute the following commands to get this working
sudo pip uninstall facebook
sudo pip uninstall facebook-sdk
sudo pip install facebook-sdk
For other operating systems, just remove facebook
and facebook-sdk
packages and install only facebook-sdk
.
And then execute that program, it will work. Looks like facebook
module is a dummy module. What we actually need is facebook-sdk
only.