问题描述:

I am not too familiar with Python and have the need to use an oauth-proxy server and one created in python was recommended.

I was given the straightforward instructions to run "easy_install oauth-proxy" from the cmd line after installing python. I have ActiveState Python 2.7 installed and did that and everything seemed to progress to install the set of python scripts (various messages downloading, copying and installing packages with no error messages).

I am now supposed to be able to simply type oauth-proxy --consumer-key [your public key] --consumer-secret [your private key] on the cmd line but these instructions are for MAC OS and I am running win 7. When I do this I get the error 'oauth-proxy' is not recognized as an internal or external command, operable program or batch file.

I can see that as a result of running easy_install, there is now a file with no extension called oauth-proxy in the C:\Python27\Scripts location. It is a text file with contents:

#!/bin/sh

twistd -n oauth_proxy $*

C:\Python27\Scripts is on my path, how I do I run this file on windows? I am assuming this text file is some sort of wrapper, but can't figure out anyway to invoke it?

网友答案:

Try making a copy of that file and name the copy oauth-proxy.bat with the first line removed, then try it from the command-line. The #!/bin/sh tells a *nix system which program to use to open the file. The line twistd -n oauth_proxy $* is a command-line shortcut for Twisted, I am guessing easy_install got that dependency. If you get an error saying 'twistd' is not recognized as an internal or external command, operable program or batch file. that means that your path variable doesn't know where Twisted is.

What happens when you run twistd.py -n oauth_proxy $* from C:\Python27\Scripts.

网友答案:

I presume you got this from here or similar: https://github.com/mojodna/oauth-proxy

I was suprised (as Ionut will be) to find that this is not a library, but actually some scripts, as you have described.

However, this oauth-proxy script is fundamentally a unix thing.

Windows is not going to know what to do with $*

I can see that Twisted is supported on Windows (http://twistedmatrix.com/trac/wiki/Downloads) but I can't see anything that tells me oauth-proxy is.

If you can find that the easy-install of oath-proxy actually did install twisted, then you might be able to find the twisted executable (twistd.exe or twistd.bat), confirm it is on your path, and run it directly from the command line, with the actual arguments you want to pass to oauth-proxy instead of $*.

I'm guessing there are still headaches ahead, like how does twisted find the oauth-proxy file that you are telling it about?

You might be better repaid to google further than I did and check if this thing is truly supported under Windows :)

Note that running the oauth-proxy.py from the distribution that I found and pointed to above is not going to help you - that file is just a class library.

相关阅读:
Top