> Anyway, I'll try to pick through the various threads and figure it out,
> but
> if someone has any info about the current architecture of lilypond
> launching
> python, how python finds the libraries it needs, etc..you could save me
> a
> lot of time to understand the issues.
>
[Some ramblings about python ahead..]
(I have my lilypond installed in d:\lilypond)
Basically, when you start python (d:\lilypond\usr\bin\python.exe) it will
import site.py (d:\lilypond\usr\lib\python2.4\site.py)
which performs some initialization and also imports sitecustomize.py (if
available).
I presume the lib directory/directories is settable at compile time, since
in a python distribution from python.org the lib folder is
<installpath>\lib
Anyway if you start up a python console then you can import sys and look
at sys.path to see where it looks for its stuff
>>> import sys
>>> sys.path
['', 'd:\\LilyPond\\usr\\lib/python24.zip',
'd:\\LilyPond\\usr\\lib/python2.4\\',
'd:\\LilyPond\\usr\\lib/python2.4\\plat-mingw32',
'd:\\LilyPond\\usr\\lib/python2.4\\lib-tk',
'd:\\LilyPond\\usr\\lib/python2.4\\lib-dynload']
>>>
However, *something* is badly broken, since when you start python by
itself in verbose mode you (which you do, because of the message that import
site failed..) get the following message
SystemError: NULL result without error in PyObject_Call
Here PyObject_Call is "the" C api function for calling python
functions/methods/everything and in the C API you return NULL when something
went bad, but you also set the exeption to throw in python land by
PyErr_Set* functions
And here it seems that some function call failed, but did not set the
exeption properly. To get to the bottom with this probably would require
running under a debugger..
..fiddling around further reveals that
import os
also fails with the same error message
The lilypond python seems to be built with a lot less "builtin modules"
than a python.org python
[Lilypond python]
>>> sys.builtin_module_names
('__builtin__', '__main__', '_codecs', '_sre', '_symtable', 'errno',
'exceptions', 'gc', 'imp', 'marshal', 'nt', 'signal', 'sys', 'xxsubtype',
'zipimport')
[vanilla python 2.4.1]
>>> sys.builtin_module_names
('__builtin__', '__main__', '_bisect', '_codecs', '_codecs_cn',
'_codecs_hk', '_codecs_iso2022', '_codecs_jp', '_codecs_kr', '_codecs_tw',
'_csv', '_heapq', '_hotshot', '_locale', '_multibytecodec', '_random',
'_sre', '_subprocess', '_symtable', '_weakref', '_winreg', 'array',
'audioop', 'binascii', 'cPickle', 'cStringIO', 'cmath', 'collections',
'datetime', 'errno', 'exceptions', 'gc', 'imageop', 'imp', 'itertools',
'marshal', 'math', 'md5', 'mmap', 'msvcrt', 'nt', 'operator', 'parser',
'regex', 'rgbimg', 'sha', 'signal', 'strop', 'struct', 'sys', 'thread',
'time', 'xxsubtype', 'zipimport')
lilypond python instead provides them in
d:\lilypond\usr\lib\python2.4\lib-dynload. A number of these seem to be
broken though, the error being
SystemError: NULL result without error in PyObject_Call
alternatively
ImportError: DLL load failed: Attempt to access invalid address
Hope this helps someone..
/Simon