[Tutor] Using module Facebook

Chris ch2009 at arcor.de
Fri Jul 18 05:54:12 CEST 2014


Dear All,

I'm trying to use the facebook-sdk for python [1]. I'm asking here and
not on the SDK groups, because I think this is a basic beginner's
question, not directly related to the framework.

I installed facebook-sdk:
	virtualenv .
	source bin/activate
	pip install facebook-sdk
	pip install requests

and I'm trying to use it now:

	#!/usr/bin/python
	from facebook import Facebook
	token = 'xxx'
	graph = facebook.GraphAPI(token)
	profile = graph.get_object("me")
	friends = graph.get_connections("me", "friends")
	friend_list = [friend['name'] for friend in friends['data']]
	print friend_list

but I'm getting the following error:

	(facebook)[chris at cd facebook]$ ./fb1.py
	Traceback (most recent call last):
	  File "./fb1.py", line 3, in <module>
	    from facebook import Facebook
	ImportError: No module named facebook

facebook.py is in:

	./lib/python2.6/site-packages/facebook.py

Thank you in advance.


[1] https://github.com/pythonforfacebook/facebook-sdk

-- 
Christian


More information about the Tutor mailing list