View previous topic :: View next topic |
Author |
Message |
iandoug l33t
Joined: 11 Feb 2005 Posts: 832 Location: Cape Town, South Africa
|
Posted: Sun Apr 07, 2013 8:44 am Post subject: Apache Thrift and python version [SOLVED] |
|
|
hi
I need to develop a subsystem using Apache Thrift.
For reasons best known to the sky gods, Thrift only installs and works on python 2. My system was set to use Python 3.
Is it possible to tell a particular program which version of Python to use, or am I now required to run permanently at Python 2 level?
(and hope that I don't need to run something that wants V 3...)
In particular, the runserver.py code, which is
Code: |
# comments removed here
import os
import BaseHTTPServer
import CGIHTTPServer
# chdir(2) into the tutorial directory.
os.chdir(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
class Handler(CGIHTTPServer.CGIHTTPRequestHandler):
cgi_directories = ['/php']
BaseHTTPServer.HTTPServer(('', 8080), Handler).serve_forever()
|
dies thusly in V 3:
Code: |
Traceback (most recent call last):
File "php/runserver.py", line 23, in <module>
import BaseHTTPServer
ImportError: No module named BaseHTTPServer
|
BaseHTTPServer does not seem to exist in v3:
Code: |
$ locate BaseHTTPServer
/usr/lib64/python2.6/BaseHTTPServer.pyc
/usr/lib64/python2.6/BaseHTTPServer.pyo
/usr/lib64/python2.7/BaseHTTPServer.py
/usr/lib64/python2.7/BaseHTTPServer.pyc
/usr/lib64/python2.7/BaseHTTPServer.pyo
/usr/share/jython/Lib/BaseHTTPServer.py
|
All suggestions gratefully received.
thanks, Ian _________________ Asus X570-PRO, Ryzen 7 5800X, GeForce GTX 1650, 32 GB RAM | Asus Sabertooth P990, AMD FX-8150, GeForce GTX 560, 16GB Ram
Last edited by iandoug on Sun Apr 07, 2013 6:56 pm; edited 1 time in total |
|
Back to top |
|
|
Hu Moderator
Joined: 06 Mar 2007 Posts: 21633
|
Posted: Sun Apr 07, 2013 3:26 pm Post subject: |
|
|
You should have a /usr/bin/python2 that runs the currently active Python 2 slot, even when the currently active global Python slot is a Python3 slot. If so, you can change the scripts to be interpreted through /usr/bin/python2. |
|
Back to top |
|
|
iandoug l33t
Joined: 11 Feb 2005 Posts: 832 Location: Cape Town, South Africa
|
Posted: Sun Apr 07, 2013 6:55 pm Post subject: |
|
|
Hu wrote: | You should have a /usr/bin/python2 that runs the currently active Python 2 slot, even when the currently active global Python slot is a Python3 slot. If so, you can change the scripts to be interpreted through /usr/bin/python2. |
Yes thanks, I figured that out after reading http://redsymbol.net/articles/env-and-python-scripts-version/ and trying to see how to make that work on Gentoo. The symlinks are not necessary for my situation.
Cheers, Ian _________________ Asus X570-PRO, Ryzen 7 5800X, GeForce GTX 1650, 32 GB RAM | Asus Sabertooth P990, AMD FX-8150, GeForce GTX 560, 16GB Ram |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|