From: brian z. <bz...@zi...> - 2001-05-07 18:40:57
|
It's not implemented in Jython because the JVM does not provide access to the environment. You'd have to write JNI code to get such a facility (I think Finn wrote such a module once). The closest you get is System.getProperties(), which is not really the same thing. brian At 10:47 AM 5/7/2001 -0700, Daniel Lord wrote: >I tried with both Jython 2.0 and Jython 2.1a1, and I get the following: > >Jython 2.1a1 on java1.3.0 (JIT: null) >Type "copyright", "credits" or "license" for more information. >>>> import os >>>> os.environ['path'] >Traceback (innermost last): > File "<console>", line 1, in ? >KeyError: path > >Then just to check: > >>>> os.environ >{} >>>> > >Is it unimplemented or is my installation corrupt or incomplete? > >Here is how Python 2.1 that installed from source works: >Python 2.1 (#1, 04/28/01, 16:09:19) >[GCC Apple DevKit-based CPP 6.0alpha] on darwin1 >Type "copyright", "credits" or "license" for more information. >>>> import os >>>> os.environ['PATH'] >'~/bin/powerpc-apple-macos:/Users/daniello/bin:/usr/local/bin:/usr/bin:/bin: >/usr/local/sbin:/usr/sbin:/sbin:.' >>>> os.environ >{'JAVA_HOME': '/Library/Java/Home', 'OSTYPE': 'macos', 'MANPATH': >'~/man:/usr/local/share/man:/usr/share/man', 'DL_ENVIRONMENT_MINE_SET': '1', >'TERM_PROGRAM_VERSION': '41', '__CF_USER_TEXT_ENCODING': '0x1F5:0:0', >'PATH': >'~/bin/powerpc-apple-macos:/Users/daniello/bin:/usr/local/bin:/usr/bin:/bin: >/usr/local/sbin:/usr/sbin:/sbin:.', 'VENDOR': 'apple', 'SHLVL': '1', >'ANT_HOME': '/opt/ant', 'PWD': '/opt/jython/Doc', 'SHELL': '/bin/tcsh', >'TERM': 'vt100', 'TERMCAP': 'd0|vt100|vt100-am|vt100am|dec >vt100:\t:do=^J:co#100:li#40:cl=\\E[;H\\E[2J:sf=2*\\ED:\t:le=^H:bs:am:cm=5\\E >[%i%d;%dH:nd=2\\E[C:up=2\\E[A:\t:ce=3\\E[K:cd=50\\E[J:so=2\\E[7m:se=2\\E[m:u >s=2\\E[4m:ue=2\\E[m:\t:md=2\\E[1m:mr=2\\E[7m:mb=2\\E[5m:me=2\\E[m:\t:rf=/usr >/share/tabset/vt100:\t:rs=\\E>\\E[?3l\\E[?4l\\E[?5l\\E[?7h\\E[?8h\\E[;r\\E[0 >m\\E(B\\E)B\\E[2J:\t:ks=\\E[?1h\\E=:ke=\\E[?1l\\E>:\t:ku=\\EOA:kd=\\EOB:kr=\ >\EOC:kl=\\EOD:kb=^H:\t:ho=\\E[H:k1=\\EOP:k2=\\EOQ:k3=\\EOR:k4=\\EOS:pt:sr=2* >\\EM:vt#3:xn:\t:sc=\\E7:rc=\\E8:cs=\\E[%i%d;%dr:', 'LANG': 'en_US', >'TERM_PROGRAM': 'Apple_Terminal', 'DL_RC_SET': '1', 'HOME': >'/Users/daniello', 'USER': 'daniello', 'LOGNAME': 'daniello', 'HOST': >'localhost', 'DL_PATH_SET': '1', 'HOSTTYPE': 'macintosh', 'CLASSPATH': >'/opt/xerces/xerces.jar:/opt/apachexml/bsf.jar:/opt/apachexml/bsfengines.jar >:/opt/apachexml/smtp.jar:/opt/apachexml/pop3.jar:/opt/apachexml/xmisoap.jar: >/opt/jdom/lib/collections.jar:/opt/saxon/saxon.jar:/opt/saxon/saxon-fop.jar' >, 'ENV_SET': '', 'MACHTYPE': 'powerpc', 'GROUP': 'staff'} >>>> > >My environment: > >Mac OS X 10.0.2 with 512 MB >java version "1.3.0" >Java(TM) 2 Runtime Environment, Standard Edition (build 1.3) >Java HotSpot(TM) Client VM (build 1.3.0, mixed mode) > > > >_______________________________________________ >Jython-users mailing list >Jyt...@li... >http://lists.sourceforge.net/lists/listinfo/jython-users |