Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Apache Thrift and python version [SOLVED]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
iandoug
Apprentice
Apprentice


Joined: 11 Feb 2005
Posts: 290
Location: Cape Town, South Africa

PostPosted: Sun Apr 07, 2013 8:44 am    Post subject: Apache Thrift and python version [SOLVED] Reply with quote

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 M3A78 64, X2 6000+, PX9800 GT, 4GB Ram | Asus M4A77TD PRO, X2 245, HD4350, 4GB RAM


Last edited by iandoug on Sun Apr 07, 2013 6:56 pm; edited 1 time in total
Back to top
View user's profile Send private message
Hu
Watchman
Watchman


Joined: 06 Mar 2007
Posts: 8617

PostPosted: Sun Apr 07, 2013 3:26 pm    Post subject: Reply with quote

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
View user's profile Send private message
iandoug
Apprentice
Apprentice


Joined: 11 Feb 2005
Posts: 290
Location: Cape Town, South Africa

PostPosted: Sun Apr 07, 2013 6:55 pm    Post subject: Reply with quote

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 M3A78 64, X2 6000+, PX9800 GT, 4GB Ram | Asus M4A77TD PRO, X2 245, HD4350, 4GB RAM
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
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