From: Jim A. <ji...@tr...> - 2002-03-13 16:43:02
|
On 3/13/2002 at 11:27 AM Seabloom, Josh wrote: >- I would also like to expose some python functions into the global >namespace of any executed python script. These functions are actually >implemented in Java and provide some app-specific functionality to the >python environment. I'm not one of the 'experts', but this is how I do it and it seems to work= fine; just 'execfile' the file with the functions: InputStream functionFileStream =3D FileIO.FindFileOrStream(= functionListName, dataPath, "functions", debugLevel); python.execfile( functionFileStream, functionListName); // pass the name= for parsing errors This way the names are scoped into the top level. (My 'FindFileOrStream' finds the function file in a file or jar in the= 'dataPath'. I have a list of functions files in an XML configuration= file.) - Jim |