Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
10-10-2005, 08:50 PM
|
#1
|
LQ Newbie
Registered: Oct 2005
Distribution: Kubuntu Breezy Badger
Posts: 12
Rep:
|
Installing python module on webserver... = p
Hiya! I have a web host and I was wanting to run a python program on it. This program however depends on the twister library (more specifically, twister.internet). I have download the modules however I would need root privileges to install these modules and I don't have such access. I was wondering if there was a way to install these in my home directory and have python recognise that they are there and use them from there.
Thank you!!! =-D
|
|
|
10-10-2005, 10:40 PM
|
#2
|
Senior Member
Registered: Nov 2002
Location: CA
Distribution: redhat 7.3
Posts: 1,440
Rep:
|
Nope, that won't work. Your webserver looks at a specific location to load modules and it obviously is not looking at home directories. In essence, you need root access.
-twantrd
|
|
|
10-10-2005, 10:57 PM
|
#3
|
LQ Newbie
Registered: Oct 2005
Distribution: Kubuntu Breezy Badger
Posts: 12
Original Poster
Rep:
|
Quote:
Originally posted by twantrd
Nope, that won't work. Your webserver looks at a specific location to load modules and it obviously is not looking at home directories. In essence, you need root access.
-twantrd
|
Hm.. So there really is nothing I can do??
Thanks... = p
|
|
|
10-11-2005, 07:12 PM
|
#4
|
LQ Newbie
Registered: Oct 2005
Distribution: Kubuntu Breezy Badger
Posts: 12
Original Poster
Rep:
|
Maybe there is some export command? like "export PYTHON_MODULES=~/../.."
Or something along those lines??? = S
|
|
|
10-11-2005, 11:52 PM
|
#5
|
Senior Member
Registered: Nov 2002
Location: CA
Distribution: redhat 7.3
Posts: 1,440
Rep:
|
Quote:
Maybe there is some export command? like "export PYTHON_MODULES=~/../.."
Or something along those lines??? = S
|
Again that would not work. That command is exporting a variable called PYTHON_MODULES=... to your shell. The webserver is not going to care about that. What you need to do is put the module in the path that is defined for modules in your webserver config file AND need to set it so that the webserver will load it.
If you can't get your webhost to set this up for you, you can always just set up a plain old linux box with apache and load your python module.
-twantrd
|
|
|
10-12-2005, 06:34 PM
|
#6
|
LQ Newbie
Registered: Oct 2005
Distribution: Kubuntu Breezy Badger
Posts: 12
Original Poster
Rep:
|
Ok.. Well thanks for your help! I just thought it would be easier considering my web server is already there. I could run my own but our internet is fast yet is unreliable and will go out for very short split seconds and it always confuses stuff if I try and do any kind of web hosting stuff. Oh well, thanks for your help!!!!! = )
|
|
|
10-14-2005, 11:45 PM
|
#7
|
LQ Newbie
Registered: Oct 2005
Distribution: Kubuntu Breezy Badger
Posts: 12
Original Poster
Rep:
|
Humm... It looks like this actually is possible. From the python website, http://www.python.org/doc/2.2.3/inst...l-windows.html Cool, those are the instructions for installing python modules in your home directory for unix and ..windows.
Cool! Although I tried this and it worked until I ran out of disk space quota. I cleared everything out and it still goes past. I wonder if there is any free webhosts that allow python... hmmm
= P..
|
|
|
10-15-2005, 07:04 AM
|
#8
|
Senior Member
Registered: Nov 2002
Location: CA
Distribution: redhat 7.3
Posts: 1,440
Rep:
|
Uhh, perhaps I got confused from the title of this thread - "Installing python module on webserver....". I THOUGHT you wanted your webserver to recognize python code but the link is talking about just installing python modules. These are completely different.
So, this whole time I thought you meant loading python under apache or some kind of web service as I stated this comment above:
Quote:
If you can't get your webhost to set this up for you, you can always just set up a plain old linux box with apache and load your python module.
|
-twantrd
Last edited by twantrd; 10-15-2005 at 07:07 AM.
|
|
|
10-15-2005, 11:47 AM
|
#9
|
LQ Newbie
Registered: Oct 2005
Distribution: Kubuntu Breezy Badger
Posts: 12
Original Poster
Rep:
|
Oh! Ok, I'm sorry for the confusion. So I have got the module installed on the lib, bin, etc directories on my home folder. But at the end of the installation, it said I need to have the "sys.path" point to that directory to recognise it and load the module. I found the code
Code:
>>> import sys
>>> sys.path.append('~/lib/python')
and that seemed to go through fine when I put that in python, but It still isn't searching that directory, I wonder if there is something else I'm supposed to put... something to do with sys.path...
Hmm, Thanks! =D
|
|
|
10-16-2005, 12:11 PM
|
#10
|
Senior Member
Registered: Nov 2002
Location: CA
Distribution: redhat 7.3
Posts: 1,440
Rep:
|
Have you tried putting in the full path instead? Like sys.path.append('/home/eleaf/python')?
-twantrd
|
|
|
10-16-2005, 11:04 PM
|
#11
|
Senior Member
Registered: Aug 2003
Location: Sydney
Distribution: debian
Posts: 1,495
Rep:
|
You can use the PYTHONPATH enviroment variable. e.g. if you put
PYTHONPATH=$HOME/lib/python:$HOME/Python/lib
in your .bash_profile then the interpreter will look in the specified directories for stuff to load. The python man page describes this and other ways to automatically modify the behaviour of the interpreter.
|
|
|
10-23-2005, 07:07 PM
|
#12
|
LQ Newbie
Registered: Oct 2005
Distribution: Kubuntu Breezy Badger
Posts: 12
Original Poster
Rep:
|
Quote:
Originally posted by maroonbaboon
You can use the PYTHONPATH enviroment variable. e.g. if you put
PYTHONPATH=$HOME/lib/python:$HOME/Python/lib
in your .bash_profile then the interpreter will look in the specified directories for stuff to load. The python man page describes this and other ways to automatically modify the behaviour of the interpreter.
|
Thank You!!! This worked perfectly! = )
In a shell I do export PYTHONPATH=~/lib/python
Works great! Thank you! =-)
|
|
|
All times are GMT -5. The time now is 08:53 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|