Re: Problem importing locally installed python modules for spyce script

"Jonathan Ellis" <[email protected]> Fri, 09 Mar 2007 15:46:15 -0800
Newsgroups gmane.comp.python.spyce.general
Message-ID <[email protected]>
"site-packages" being scanned for modules before directories in
PYTHONPATH is standard Python behavior, not Spyce-specific.

One workaround it to just say

import sys
sys.path = ['/my/directory'] + sys.path

to make your directory highest priority.

P.S.  Paragraphs are your friend!

On Fri, 9 Mar 2007 22:41:27 +0000 (UTC), "Hardeep Nahal"
<[email protected]> said:
> I'm a newbie to spyce and have a question that I hope someone can help me
> with.
> I want to modify a spyce script and its associated modules which we are
> running
> on our server. Usually I make a local copy of the script (ie. a cgi
> script) so I
> can make modifications locally without affecting the main program. So for
> example, the main program is stored in '/var/www/html/some_program', and
> I've
> made a copy in my directory '/home/me/public_html/cgi-bin/some_program'.
> The
> spyce program I'm working on depends on several python modules which we
> created
> and are stored in the python directory on our server (ie.
> '/usr/local/lib/python2.3/site-packages/some_program_modules'). I've  
> copied these module files to a local copy of python as well  
> ('/home/me/lib/python2.3/site-packages/some_program_modules') because I
> want to
> make some modifications to them. However, I've noticed that when I run
> the spyce
> script, the local embedded python scripts (*.spy) are executed, but the
> program
> imports the python module files that are stored in the 
> '/usr/local/lib/python2.3/site-packages/some_program_modules'  
> directory instead of the ones stored in my local directory  
> ('/home/me/lib/python2.3/site-packages/some_program_modules'). I've
> checked the
> PYTHONPATH variable and it's set to my local python directory. I've also
> noticed
> that the spyceconfig.py file specifies a SPYCE_CLASS variable that tells
> it
> where to find modules, so I appended my own directory to SPYCE_CLASS.
> However, I
> still can't get the program to import only the locally installed modules.
> Is
> there a way to make it ignore the modules stored in
> '/usr/local/lib/python2.3/site-packages/some_program_modules', so it  
> will import from my  
> '/home/me/lib/python2.3/site-packages/some_program_modules' directory?  
> Or am I missing some variable that I should set in spyce to make it
> recognize
> which python directory I want it to load modules from? I'm running Debian
> with
> Apache 2.0.54 configured for mod_python 3.1.3, spyce 2.0.1 and Python
> 2.3. I
> don't know what other information to provide, but if anyone has any
> suggestions
> I'll gladly post the appropriate information if it helps. Thanks in
> advance.
> 
> best,
> Hardeep
> 
> 
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Spyce-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/spyce-users

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV