With doing Facebook posts with Python?

Asked

Viewed 703 times

0

import facebook

token = 'meu token'



graph = facebook.GraphAPI(token)
graph.put_object("me", "feed", message="Hello, World!")

Friends,

I’m using Ubuntu and Python 2.7 and 3.5.2

The following error occurs:

"Graph = facebook.Graphapi(ACCESS_TOKEN) Attributeerror: module 'facebook' has no attribute 'Graphapi"

I’ve searched right here on Stack Overflow but no answer solved my problem.

I installed the Facebook-SDK from here:

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

Any suggestions?

  • Try to download a ready-made code and build your app from it.

  • import facebook -> in interactive mode not errors

  • from facebook import Graphapi -> also no errors occur

  • @Cypherpotato, any hint of code?

  • Try to overload the function GraphAPI: facebook.GraphAPI(access_token='your_token', version='2.2')

  • @Cypherpotato, I did but the mistake was the same!

  • Ed, http://answall.com/questions/142790/login-no-facebook-com-python . It’s not like posting but it’s related. However using sdk is indicated

Show 2 more comments

1 answer

2


If you are using Ubuntu or Debian, run these commands to get back up and running.

sudo pip uninstall facebook
sudo pip uninstall facebook-sdk
sudo pip install facebook-sdk

For other operating systems, just remove the facebook and facebook-sdk and install only the facebook-sdk

Then run the program. Note that the module facebook is obsolete and its replacement is facebook-sdk.

Source of the answer

.

  • sudo Pip Uninstall facebook -> Cannot Uninstall requirement facebook, not installed

  • All I wanted was to get a python script to post on facebook... what a boring mistake!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.