pip command

Python is a remarkably powerful dynamic programming language that is used in a wide variety of application domains. Python is often compared to Tcl, Perl, Ruby, Scheme or Java. It lets you work more quickly and integrate your systems more effectively. You can learn to use Python and see almost immediate gains in productivity and lower maintenance costs.

Moderator: Lillian.W@AST

Post Reply
MikeG.6.5
Posts: 917
youtube meble na wymiar Warszawa
Joined: Fri May 15, 2015 1:56 am

pip command

Post by MikeG.6.5 »

If I do a pip command to install a module within Python where does this module get installed to, and how can I use it in the scripts I write?

I've tried to use one and it fails with an un-known include of the module I tried to install... (the module I tried to install was facebook-sdk and it fails with /volume1/misc/FB-Test.sh: line 1: import: not found after running pip install facebook-sdk in a PuTTY session.)

I also get this error: /volume1/misc/FB-Test.sh: line 3: syntax error: unexpected "(" when trying to run the script.

Code: Select all

import facebook

def main():
  # Fill in the values noted in previous steps here
  cfg = {
    "page_id"      : "VALUE",  # Step 1
    "access_token" : "VALUE"   # Step 3
    }

  api = get_api(cfg)
  msg = "Hello, world!"
  status = api.put_wall_post(msg)

def get_api(cfg):
  graph = facebook.GraphAPI(cfg['access_token'])
  # Get page token to post as the page. You can skip 
  # the following if you want to post as yourself. 
  resp = graph.get_object('me/accounts')
  page_access_token = None
  for page in resp['data']:
    if page['id'] == cfg['page_id']:
      page_access_token = page['access_token']
  graph = facebook.GraphAPI(page_access_token)
  return graph
  # You can also skip the above if you get a page token:
  # http://stackoverflow.com/questions/8231877/facebook-access-token-for-pages
  # and make that long-lived token as in Step 3

if __name__ == "__main__":
  main()
This code works for every other Python install in the world, but not the one on my 7004T. The code and instructions to set it all up came from here: http://nodotcom.org/python-facebook-tutorial.html
MikeG.6.5
Posts: 917
Joined: Fri May 15, 2015 1:56 am

Re: pip command

Post by MikeG.6.5 »

OK, got parts of this working... and what a can of worms so far....

Looks like it's going to be a nightmare to get it all going the way I was hoping to...
Post Reply

Return to “Python”