Closed rkallon closed 10 years ago
keep getting this error: ImportError Traceback (most recent call last)
sorry about the bad format... help needed!
A couple of quick questions:
Are you using the virtual machine yet, are you trying to run this Chapter 2 notebook on Wakari, or are you running it locally on your machine with an IPython Notebook sever? This is an important detail in terms of moving forward.
In terms of the root issue, note the instructions to install the "facebook" package with pip by typing "pip install facebook-sdk". If you don't yet know about pip, you'll want to read about it here - https://pypi.python.org/pypi/pip - or search for it and do a little bit of research. It's a common Python tool that you will need to use to install 3rd party packages.
The way the book is designed, I need to try and funnel everyone onto the VM platform so that I can better support them, but since you are still based out of China, you are likely to experience the same kinds of firewall issues that you did with the Twitter package, and I'm more than happy to help you find creative ways to work around the constraints.
However, realize that you'll also have to work with me here to do a little homework along the way since there will be a bit of learning curve involved if you're not yet a Python programmer. I'm gathering so far that you are looking for some quick fixes, but the truth of the matter is that learning to program will take a little bit of investment, so give yourself enough breathing room to work through things and really grok the underlying concepts.
I'm running chap 2 on wakari. I'll find the pip article and get familiar with it.
I ran the first example on wakari and there was no problem... I'm also doing a python tutorial... I'm in for the long haul and I'm following the concepts.
Sounds good.
The fundamental concept that you're missing here is what the "import" statement does and how certain packages that are imported are already packaged with Python as part of its standard library versus which packages are 3rd party packages that need to be installed...with pip being a tool that is essentially the defacto standard for installing Python packages at this point.
HTH.
forgive my ignorance... i read somewhere that i can open a shell terminal in wakari and install a module i need that wakari doesn't include as a default... Looking it up, will report back ASAP.
Use "Bash magic"
If the first line if the cell is "%%bash" you can run standard shell commands, including pip, just like in a terminal
On Jan 14, 2014, at 1:06 PM, rkallon notifications@github.com wrote:
forgive my ignorance... i read somewhere that i can open a shell terminal in wakari and install a module i need that wakari doesn't include as a default... Looking it up, will report back ASAP.
— Reply to this email directly or view it on GitHub.
worked! thanks for your patience...
My pleasure. Glad to help you in any way that I can...
On Jan 14, 2014, at 1:43 PM, rkallon notifications@github.com wrote:
worked! thanks for your patience...
— Reply to this email directly or view it on GitHub.
import facebook # pip install facebook-sdk import json
A helper function to pretty-print Python objects as JSON
def pp(o): print json.dumps(o, indent=1)
Create a connection to the Graph API with your access token
g = facebook.GraphAPI(ACCESS_TOKEN)
Execute a few sample queries
print '---------------' print 'Me' print '---------------' pp(g.get_object('me')) print print '---------------' print 'My Friends' print '---------------' pp(g.get_connections('me', 'friends')) print print '---------------' print 'Social Web' print '---------------' pp(g.request("search", {'q' : 'social web', 'type' : 'page'}))