Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

oauth.py is no longer python 2 compatible #349

Open
aransfor opened this issue Nov 17, 2017 · 5 comments
Open

oauth.py is no longer python 2 compatible #349

aransfor opened this issue Nov 17, 2017 · 5 comments

Comments

@aransfor
Copy link

aransfor commented Nov 17, 2017

at some point the oauth file switched its import from the python 2 package BaseHTTPServer to they python 3 package http.server which seems to affect servers such as the gpib server for python 2 users. We have since downgraded to an old version of pylabrad (0.95.3)

@jayich
Copy link
Member

jayich commented Nov 18, 2017

@maffoo
Copy link
Contributor

maffoo commented Nov 18, 2017

pylabrad will still work with python2.7 after the referenced change, but there are some additional dependencies that must be installed. All the dependencies are listed in requirements.txt. In particular, a backported version of the python 3 http.server library is included with the future package, so you will need to run pip install future (or, more generally, pip install -r requirements.txt to get all required dependencies). Actually, I'd be curious to know how you are using pylabrad, because if you are pip installing it from pypi, then pip should pull in all the requirements for you automatically. But if you're just checking out the source code and putting it on your python path then you'll need to install the dependencies manually.

@aransfor
Copy link
Author

We pip install so just doing pip install pylabrad is not sufficient I will try pip install futures

@maffoo
Copy link
Contributor

maffoo commented Nov 19, 2017

Another thing to check for is if you have some other http package on the python path. For example, the martinisgroup/servers repo has an http package (https://github.com/martinisgroup/servers/tree/master/http) so if that is on your pythonpath, then the code in oauth.py might try to import that instead of the backported http package from future, which is what you want. In a python session you can do import http and then look at http.__file__ to see which package is actually getting imported. (There's a PR to rearrange the servers repo to move everything into a labrad.servers subpackage to avoid package name collision issues like this, but it's not merged yet.)

@xiaoyuejin
Copy link

xiaoyuejin commented Nov 24, 2017

It's great to see that someone is having the same trouble. :)

I just started to try upgrading to the latest version of pylabrad and everything else from a version that is 6-7 years old. Using Python 2.7 and running into the same trouble. The latest Data Vault 3.0.1 refuses to start with http.server error.

My solution is commenting out the 3 lines in the oauth file that are related to http.server and replacing them with BaseHTTPServer. Then the data vault can start now (although I am having much bigger issues trying to jump from old Delphi era to end of 2017).

I will try the pip requirement.txt upgrade and report back.

--Update: I just checked and confirmed that I've met all the requirement mentioned in requirement.txt but http.server still reports an error. I still have to hack the file and import BaseHTTPServer to run Data Vault.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants