[Bf-python] sitedirs and Python 2.4

Jonathan Merritt j.merritt at pgrad.unimelb.edu.au
Sun Oct 30 04:22:45 CET 2005


Hi Ken,

I should have read your email more carefully.  If I do the following 
within Blender:
    >>> import site
    >>> site.main()
    >>> import sys
    >>> print sys.path
then the site-packages directories *do* appear.  Without calling 
site.main(), however, they don't appear:
    >>> import site
    >>> import sys
    >>> print sys.path
So, your patch will work at my end.

I still don't understand it though.

The source for site.py looks like it calls main() from the top level of 
the file when it's imported.  Why should main() need to be called 
separately?  Is this a known difference in behaviour in the embedded 
interpreter compared with the normal command-line version?

Jonathan.

Jonathan Merritt wrote:

> The wierd thing is that when I do an:
>    >>> import sys
>    >>> print sys.path
> from the native Python command-line interpreter, the site-packages 
> directories are all present.  However, when I do the same thing from 
> within Blender it doesn't include the site-packages!  They still 
> aren't present even if I first manually "import site" within Blender, 
> although "import site" raises no exceptions.




More information about the Bf-python mailing list