From: Chris A. <at...@nm...> - 2001-01-23 18:02:46
|
> > >I am embedding jython in my code. How would I pass the -D > options to the > >InteractiveConsole? > > Take a look at 6.2 in the faq: > > http://jython.sourceforge.net/cgi-bin/faqw.py?req=all#6.2 > > You can set python.security.respectJavaAccessibility in the > same way. It > most be done before creating any python objects, including > the creation > of the interpreter. > In my java code I do the following: java.util.Properties props = System.getProperties(); add properties for other tools with names which do not conflict with python PySystemState.initialize(pyProps, null, s_scriptArgs); I start up my app with PYFLAGS="-Dpython.home=$JPYTHONDIR -Dpython.path=$JPYTHONPATH -D python.cachedir=$JPYTHONCACHEDIR" java -classpath . $PYFLAGS MyClass args This should have place the python properties in both the system properties and set them on the interactive console. According to the rules, it should have picked up the $PYFLAGS over the registry since set on the PySystemState. It instead used what is in the registry. I changed my code to do the following: java.util.Properties pyProps = new java.util.Properties(); pyProps.setProperty("python.security.respectJavaAccessibility", "0"); if (s_scriptArgs == null) s_scriptArgs = new String[0]; PySystemState.initialize(pyProps, null, s_scriptArgs); Now, since I am not setting python.home, python.path, python.cachedir in my java code, they are not being picked up from the system properties set on the command line. Can you explain this? I really want to pick up the properties which have path names from the command line, but the application specific settings such as respectJavaAccessibility from the application. Chris Atkins |