From: Justin Gullingsrud (justin_at_ks.uiuc.edu)
Date: Tue Feb 04 2003 - 10:50:35 CST

Oliver,

We've reproduced the problem you've described; it does look as though
the results from os.listdir() are being corrupted, which could be the
direct cause of site packages not being loaded as well as evidence of
a more widespread problem. Thanks a lot for letting us know; we're
looking into and we'll get back to you when we know more.

Justin

On Tue, Feb 04, 2003 at 03:45:46PM +0000, Oliver Beckstein wrote:
> Hello,
>
> I am running VMD 1.8 (December 9, 2002) on a Linux RedHat 8.0 system
> with python 2.2. Apparently, the built-in python interpreter does not
> find Numeric which is installed in
> /usr/lib/python2.2/site-packages/Numeric and has a proper Numeric.pth
> file in site-packages. This is a bit odd, given that the path seems to
> be ok:
>
> >>> import sys
> >>> sys.path
> ['', '/usr/local/lib/vmd/scripts/python', '/usr/local/lib/vmd/plugins/LINUX/python', '/usr/local/lib/vmd/plugins/noarch/python', '/usr/lib/python2.2', '/usr/lib/python2.2/plat-linux2', '/usr/lib/python2.2/lib-tk', '/usr/lib/python2.2/lib-dynload', '/usr/lib/python2.2/site-packages']
>
> However, importing fails:
> >>> import Numeric
> Traceback (most recent call last):
> File "VMD", line 1, in ?
> ImportError: No module named Numeric
>
> I tried to run the 'magic' site-import facility manually (I think,
> for 2.2 it really works automagically):
>
> >>> import site
> >>> sys.path
> ['', '/usr/local/lib/vmd/scripts/python', '/usr/local/lib/vmd/plugins/LINUX/python', '/usr/local/lib/vmd/plugins/noarch/python', '/usr/lib/python2.2', '/usr/lib/python2.2/plat-linux2', '/usr/lib/python2.2/lib-tk', '/usr/lib/python2.2/lib-dynload', '/usr/lib/python2.2/site-packages']
>
> but as you can see, /usr/lib/python2.2/site-packages/Numeric is not
> added.
>
> However, if I run the whole session in my system's python interpreter
> everything works.
>
> I think I traced it down to a call in site.py where a list of all the
> *.pth files is generated:
>
> names = os.listdir(sitedir)
>
> It seems that os.listdir() generates garbage when run from within
> vmd. Consider an example test directory with contents
>
> > ls
> bar boing foo
>
> >From python (external):
>
> > python
> Python 2.2.1 (#1, Aug 30 2002, 12:15:30)
> [GCC 3.2 20020822 (Red Hat Linux Rawhide 3.2-4)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import os
> >>> os.listdir('.')
> ['bar', 'boing', 'foo']
>
> >From vmd:
> > vmd -python
> >>> import os
> >>> os.listdir('.')
> ['', '', '', 'g', '']
>
>
> This list cannot be parsed succesfully by site.py and hence no
> additional modules are found.
>
> In general, I am slightly worried because I don't know where similar
> bugs might come up; in particular I'd like to use the python
> interpreter in vmd with different additional modules.
>
> Has anyone got an idea where this might come from, or have I got to
> set some special environment variables? Could it be some
> incompatibility between vmd's python and mine? I should add that there
> is also a small directory /usr/lib/python1.5 which, however, does not
> seem to be in the path or otherwise directly used.
>
> Thanks for any help,
> Oliver
>
>
>
> --
> Oliver Beckstein * oliver_at_bioch.ox.ac.uk
> http://indigo1.biop.ox.ac.uk/oliver/

-- 
  Justin Gullingsrud        3111 Beckman Institute        217-244-8946
  I been dropping the new science, and I be kicking the new knowledge,
  and I'm seeing to a degree that you can't get in college.  -- b.boys