From: <gre...@ne...> - 2002-01-11 01:17:27
|
Can anyone help me with an embedding question? I have an interface that I need to implement. When my method is called, I want to run an interactive interpreter (that part works fine) and be able to access some variables easily from within modules (I can't figure out how to do this). Here is the code I have: public class PythonDoclet implements Doclet { public static File outputDir; public static Map classesByName; public static List nodes; public static List loaders; public void generateDocumentation(File outputDir, Map classesByName, List nodes, List loaders) { InteractiveConsole interpreter = new InteractiveConsole(); PythonDoclet.outputDir = outputDir; PythonDoclet.classesByName = classesByName; PythonDoclet.nodes = nodes; PythonDoclet.loaders = loaders; interpreter.interact(); } } When the interpreter starts up, I can access PythonDoclet.outputDir (for instance) in the console and that works great. What I can't figure out is how to write a module that can access the same attribute. I have a module that looks like: import PythonDoclet print outputDir when I import it from the interactive console, I get this error: >>> import toXml Traceback (innermost last): File "<console>", line 1, in ? File "d:\home\greg\projects\dig\users\greg\ogredoc2docbook\.\toXml.py", line 4 , in ? NameError: outputDir It seems odd to me that I can access outputDir just fine when typing in the console, but not from a module. Any tips would be appreciated. tia - Greg -- __________________________________________________________________ Your favorite stores, helpful shopping tools and great gift ideas. Experience the convenience of buying online with Shop@Netscape! http://shopnow.netscape.com/ Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/ |