2

This is my first time playing with python on a computer instead of using online modules. I'm trying to install Oath2 but the web searches I've found have a number of different ways of doing it and they each seem to present their own error when I try it.

One way I've seen is by using a command line link in this thread:

easy_install pywhois

or

easy_install oauth2

Installing a Python module in Windows

That returns an invalid syntax error.

Another way I tried was to download the tz file and move it into the site-packages folder and then run:

import oath2 

[typo, I used "oauth2" in the actual command]

That also returns an invalid syntax error.

I've been combing through the threads here and other places and I just can't seem to crack this.

Community
  • 1
  • 1
TryHarder01
  • 48
  • 1
  • 8

3 Answers3

2

could it be that you should be doing

import oauth2

and not

import oath2

You could alternatively use activestate python which has a lot of built-in modules, and then install any extra ones like oauth2 using the command-line command:

pip install oauth2

or

pypm install oauth2

Another way of getting it would be to download the tarball, unzip it, open a command line, change directories to the unzipped folder, and run

python setup.py install
Tadgh
  • 1,999
  • 10
  • 23
  • I made a typo in writing this post, on the command line I wrote "auth2" I fixed my post to reflect that. I thought I attempted your last suggestion. I have downloaded the tarball file and unzipped it but when I try that "python setup.py install" I get: "Python is not recognized as an internal or external command" – TryHarder01 May 18 '13 at 11:49
  • That means that you do not have python set in your PATH environment variable. If you are on windows, you need to follow the instructions [here](http://stackoverflow.com/questions/3701646/how-to-add-to-the-pythonpath-in-windows-7). Alternatively, you can just append C:\path_to_your_python_folder to the system's PATH variable – Tadgh May 18 '13 at 12:29
2

While I tried to install oauth2 I received a syntax error as well. The error code was:

File "setup.py", line 18 
print "unable to find version in %s" %(VERSIONFILE,)
SyntaxError: invalid syntax

My fix was, to add the missing brackets in the print statement.

print("unable to find version in %s" %(VERSIONFILE,)) 

That was it. I hope that helped.

0

When working with Python 3 make sure print in the setup.py has correct syntax. If there is error like:

 File "<string>", line 17, in <module>
      File "C:\Users\Neeraj\AppData\Local\Temp\pip_build_Neeraj\oauth2\setup.py", line 18
        print "unable to find version in %s" % (VERSIONFILE,)

Change it to reflect the following

print ("unable to find version in %s" % (VERSIONFILE,))
Neeraj
  • 596
  • 7
  • 9