LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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


Reply
  Search this Thread
Old 10-10-2005, 08:50 PM   #1
Eleaf
LQ Newbie
 
Registered: Oct 2005
Distribution: Kubuntu Breezy Badger
Posts: 12

Rep: Reputation: 0
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
 
Old 10-10-2005, 10:40 PM   #2
twantrd
Senior Member
 
Registered: Nov 2002
Location: CA
Distribution: redhat 7.3
Posts: 1,440

Rep: Reputation: 52
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
 
Old 10-10-2005, 10:57 PM   #3
Eleaf
LQ Newbie
 
Registered: Oct 2005
Distribution: Kubuntu Breezy Badger
Posts: 12

Original Poster
Rep: Reputation: 0
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
 
Old 10-11-2005, 07:12 PM   #4
Eleaf
LQ Newbie
 
Registered: Oct 2005
Distribution: Kubuntu Breezy Badger
Posts: 12

Original Poster
Rep: Reputation: 0
Maybe there is some export command? like "export PYTHON_MODULES=~/../.."

Or something along those lines??? = S
 
Old 10-11-2005, 11:52 PM   #5
twantrd
Senior Member
 
Registered: Nov 2002
Location: CA
Distribution: redhat 7.3
Posts: 1,440

Rep: Reputation: 52
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
 
Old 10-12-2005, 06:34 PM   #6
Eleaf
LQ Newbie
 
Registered: Oct 2005
Distribution: Kubuntu Breezy Badger
Posts: 12

Original Poster
Rep: Reputation: 0
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!!!!! = )
 
Old 10-14-2005, 11:45 PM   #7
Eleaf
LQ Newbie
 
Registered: Oct 2005
Distribution: Kubuntu Breezy Badger
Posts: 12

Original Poster
Rep: Reputation: 0
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..
 
Old 10-15-2005, 07:04 AM   #8
twantrd
Senior Member
 
Registered: Nov 2002
Location: CA
Distribution: redhat 7.3
Posts: 1,440

Rep: Reputation: 52
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.
 
Old 10-15-2005, 11:47 AM   #9
Eleaf
LQ Newbie
 
Registered: Oct 2005
Distribution: Kubuntu Breezy Badger
Posts: 12

Original Poster
Rep: Reputation: 0
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
 
Old 10-16-2005, 12:11 PM   #10
twantrd
Senior Member
 
Registered: Nov 2002
Location: CA
Distribution: redhat 7.3
Posts: 1,440

Rep: Reputation: 52
Have you tried putting in the full path instead? Like sys.path.append('/home/eleaf/python')?

-twantrd
 
Old 10-16-2005, 11:04 PM   #11
maroonbaboon
Senior Member
 
Registered: Aug 2003
Location: Sydney
Distribution: debian
Posts: 1,495

Rep: Reputation: 48
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.
 
Old 10-23-2005, 07:07 PM   #12
Eleaf
LQ Newbie
 
Registered: Oct 2005
Distribution: Kubuntu Breezy Badger
Posts: 12

Original Poster
Rep: Reputation: 0
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! =-)
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
no python module base.g? hcgernhardt Linux - Software 2 04-24-2018 09:03 AM
using distutils to install a python module shanenin Programming 2 11-29-2005 09:44 PM
installing python library's (Python Numeric) Four Linux - Newbie 1 10-16-2005 02:31 PM
Installing the Python om my Apache 1.3.3 webserver CPUFreak91 Linux - Software 1 09-02-2005 08:09 PM
Help me (python and MySQLdb module) Dark Carnival Programming 2 04-22-2004 07:31 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:13 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration