From: <cl...@br...> - 2007-04-25 18:39:30
|
Dear Lyndon,=20 enclosed you find a "javaneese" approach for get access to the Unix man=20 commands. The sample below use the Java native OS runtime access. It=20 works for SOLARIS OS commands as well as for WINDOWS "prompt"=20 interfaces.=20 from java.lang import Runtime from java.io import BufferedReader from java.io import InputStreamReader p =3D Runtime.getRuntime().exec("man -k man")=20 stdInput =3D BufferedReader(InputStreamReader(p.getInputStream())) stdError =3D BufferedReader(InputStreamReader(p.getErrorStream())) print "Here is the standard output of the command:\n" s =3D ' '=20 while (s !=3D None):=20 s =3D stdInput.readLine() if (s is None):=20 print 'end-of-console-printout\n' else:=20 print s=20 print "Here is the standard error of the command (if any):\n" s =3D ' '=20 while (s !=3D None): s =3D stdError.readLine() if (s is None):=20 print '' else:=20 print s=20 Regards,=20 Claude Claude Falbriard=20 Developer=20 AMS Hortol=E2ndia / SP - Brazil=20 phone: +55 13 8117 3316 e-mail: cl...@br... <lyn...@th...>=20 Sent by: jyt...@li... 04/25/2007 02:37 PM To <jyt...@li...> cc Subject [Jython-users] what to use in place of pydoc ? Jython users: =20 Hi. I'm fairly new to jython & python; but moving long in the learning=20 curve. I've been porting some python & mxODBC code to jython and zxJDBC; and ran=20 into something. One of the program's options is to display a "man-page" using pydoc; which = of course isn't in jython . How do I go about duplicating this effect in jython ? =20 BTW, I'm running jython-2.2b1, java 6.0u1 on Solaris 10 x86. =20 Thanks. =20 --Lyndon ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ =5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F= =5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F Jython-users mailing list Jyt...@li... https://lists.sourceforge.net/lists/listinfo/jython-users |