[Tutor] PYTHONPATH - got it

Michael Baker michaelbaker@operamail.com
Mon, 26 Feb 2001 17:35:32 -0500

I added this line to /etc/profile:

export PYTHONPATH=.:/usr/lib/python1.5/

...and all appears to be well. thanks for the help. btw typing the same in a 
shell prior to launching Blender works too, but is less convenient.

>===== Original Message From Bruce Sass <bsass@freenet.edmonton.ab.ca> =====
>On Sun, 25 Feb 2001, Dinakar wrote:
>> how to change the path shown by sys.path. Does one need to change 
>> in .bashrc or someother file. I would appreciate, if some one on the group
>> clarify this.
>Well, you have at least two choices regarding PYTHONPATH; put it in
>the system wide shell profile (/etc/profile), or your per-user shell
>profile (.bashrc, .cshrc, both if you use both shells).  This really
>has little to do with Python, use private-email if you need help with
>shell stuff.
>What I'm wondering is if it is Blender you need to tell about Python
>modules, or Python you need to tell about Blender modules?  In the
>first case, setting the PYTHONPATH in the environment is probably the
>thing to do; in the second case it would be best to but the Blender
>modules on the sys.path.
>What I would do is find the location of the modules that are not being
>found automatically, if they are not on the sys.path then make a
>symlink from the dir containing the missing modules to inside a dir on
>the sys.path.  Exactly where this link points to depends on the
>characteristics of the modules and whether or not Blender (assuming
>Blender module are out of place) is from a .rpm or not.  If the Python
>code in Blender depends on Python-1.5, then use
>/usr/lib/python1.5/site-packages; if it will work with any version of
>Python, use /usr/lib/site-python; if you built Blender yourself, use
>/usr/local/lib/{python1.5,site-packages}, as appropriate.
>- Bruce
>> Bruce Sass wrote:
>> > On Sat, 24 Feb 2001 michaelbaker@operamail.com wrote:
>> > > I'm  LinuxPPC (based on Red Hat 6.1), the python interpreter works just
>> > > fine, but another program (Blender) which has a pyhton API cannot find
>> > > modules to import. I'm trying to change my .cshrc file to set 
>> > > without luck. I've added this line to my .cshrc:
>> > >
>> > > setenv PYTHONPATH "/usr/lib/python1.5/"
>> > >
>> > > this doesn't work - help???
>> > > thanks
>> >
>> > This is what python 1.5.2 thinks the path is on my Debian box,
>> >
>> > >>> sys.path
>> > ['', '/usr/lib/python1.5/', '/usr/lib/python1.5/plat-linux2',
>> > '/usr/lib/python1.5/lib-tk', '/usr/lib/python1.5/lib-dynload',
>> > '/usr/local/lib/python1.5/site-packages',
>> > '/usr/local/lib/site-python', '/usr/lib/python1.5/site-packages',
>> > '/usr/lib/python1.5/site-packages/HTMLgen',
>> > '/usr/lib/python1.5/site-packages/PIL',
>> > '/usr/lib/python1.5/site-packages/graphics',
>> > '/usr/lib/python1.5/site-packages/Numerical',
>> > '/usr/lib/site-python']