You can subscribe to this list here.
2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(6) |
Nov
(8) |
Dec
(51) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
(105) |
Feb
(93) |
Mar
(194) |
Apr
(145) |
May
(100) |
Jun
(111) |
Jul
(117) |
Aug
(126) |
Sep
(233) |
Oct
(138) |
Nov
(164) |
Dec
(109) |
2002 |
Jan
(216) |
Feb
(175) |
Mar
(216) |
Apr
(194) |
May
(157) |
Jun
(140) |
Jul
(158) |
Aug
(73) |
Sep
(105) |
Oct
(164) |
Nov
(104) |
Dec
(95) |
2003 |
Jan
(72) |
Feb
(69) |
Mar
(81) |
Apr
(151) |
May
(101) |
Jun
(139) |
Jul
(99) |
Aug
(118) |
Sep
(115) |
Oct
(151) |
Nov
(161) |
Dec
(102) |
2004 |
Jan
(120) |
Feb
(175) |
Mar
(106) |
Apr
(111) |
May
(54) |
Jun
(78) |
Jul
(76) |
Aug
(105) |
Sep
(94) |
Oct
(143) |
Nov
(75) |
Dec
(85) |
2005 |
Jan
(99) |
Feb
(77) |
Mar
(164) |
Apr
(97) |
May
(79) |
Jun
(57) |
Jul
(65) |
Aug
(102) |
Sep
(95) |
Oct
(129) |
Nov
(123) |
Dec
(52) |
2006 |
Jan
(48) |
Feb
(99) |
Mar
(90) |
Apr
(51) |
May
(81) |
Jun
(136) |
Jul
(56) |
Aug
(109) |
Sep
(50) |
Oct
(44) |
Nov
(74) |
Dec
(75) |
2007 |
Jan
(92) |
Feb
(137) |
Mar
(93) |
Apr
(79) |
May
(52) |
Jun
(74) |
Jul
(143) |
Aug
(175) |
Sep
(154) |
Oct
(137) |
Nov
(88) |
Dec
(90) |
2008 |
Jan
(58) |
Feb
(113) |
Mar
(167) |
Apr
(88) |
May
(105) |
Jun
(37) |
Jul
(87) |
Aug
(72) |
Sep
(56) |
Oct
(41) |
Nov
(102) |
Dec
(70) |
2009 |
Jan
(115) |
Feb
(113) |
Mar
(126) |
Apr
(58) |
May
(125) |
Jun
(45) |
Jul
(90) |
Aug
(125) |
Sep
(84) |
Oct
(61) |
Nov
(111) |
Dec
(61) |
2010 |
Jan
(85) |
Feb
(86) |
Mar
(130) |
Apr
(58) |
May
(57) |
Jun
(32) |
Jul
(25) |
Aug
(50) |
Sep
(41) |
Oct
(65) |
Nov
(63) |
Dec
(24) |
2011 |
Jan
(43) |
Feb
(31) |
Mar
(28) |
Apr
(68) |
May
(53) |
Jun
(42) |
Jul
(58) |
Aug
(26) |
Sep
(51) |
Oct
(76) |
Nov
(60) |
Dec
(9) |
2012 |
Jan
(16) |
Feb
(32) |
Mar
(32) |
Apr
(39) |
May
(16) |
Jun
(19) |
Jul
(3) |
Aug
(11) |
Sep
(35) |
Oct
(47) |
Nov
(28) |
Dec
(18) |
2013 |
Jan
(18) |
Feb
(36) |
Mar
(10) |
Apr
(7) |
May
(7) |
Jun
(27) |
Jul
(17) |
Aug
(35) |
Sep
(19) |
Oct
(31) |
Nov
(8) |
Dec
(22) |
2014 |
Jan
(5) |
Feb
(11) |
Mar
(18) |
Apr
(23) |
May
(26) |
Jun
(14) |
Jul
(18) |
Aug
(26) |
Sep
(20) |
Oct
(48) |
Nov
(13) |
Dec
(9) |
2015 |
Jan
(9) |
Feb
(15) |
Mar
(25) |
Apr
(10) |
May
(26) |
Jun
(6) |
Jul
(13) |
Aug
(5) |
Sep
(14) |
Oct
(36) |
Nov
(24) |
Dec
(18) |
2016 |
Jan
(24) |
Feb
(11) |
Mar
(1) |
Apr
(6) |
May
(7) |
Jun
(3) |
Jul
(9) |
Aug
(15) |
Sep
(22) |
Oct
(5) |
Nov
(5) |
Dec
(2) |
2017 |
Jan
(20) |
Feb
(4) |
Mar
(4) |
Apr
(1) |
May
(5) |
Jun
(7) |
Jul
(14) |
Aug
(9) |
Sep
(18) |
Oct
(2) |
Nov
(3) |
Dec
(3) |
2018 |
Jan
(7) |
Feb
(6) |
Mar
(1) |
Apr
(2) |
May
|
Jun
|
Jul
(1) |
Aug
(18) |
Sep
(8) |
Oct
(9) |
Nov
(4) |
Dec
(6) |
2019 |
Jan
(5) |
Feb
|
Mar
(2) |
Apr
(4) |
May
(6) |
Jun
(8) |
Jul
(11) |
Aug
(10) |
Sep
(6) |
Oct
|
Nov
(1) |
Dec
|
2020 |
Jan
(8) |
Feb
(3) |
Mar
(1) |
Apr
(4) |
May
(1) |
Jun
(1) |
Jul
|
Aug
|
Sep
(1) |
Oct
(5) |
Nov
(2) |
Dec
(1) |
2021 |
Jan
|
Feb
|
Mar
(5) |
Apr
(2) |
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2022 |
Jan
|
Feb
(2) |
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
(7) |
Aug
(1) |
Sep
(1) |
Oct
|
Nov
|
Dec
|
2023 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(3) |
Jun
(5) |
Jul
(15) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2024 |
Jan
|
Feb
(1) |
Mar
|
Apr
(2) |
May
|
Jun
(5) |
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2025 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Ted B. <te...@et...> - 2001-09-26 19:56:23
|
On Wednesday 26 September 2001 12:44, Samuele Pedroni wrote: > Hi. <snip> > > Given your setup this is the one: > > import pyhandlers > > have you an __init__.py or __init__$py.class there? No, I don't. Do I need to do anything special in the __init__.py file, or does it just need to be there? > regards. Many thanks! ted |
From: Samuele P. <pe...@in...> - 2001-09-26 19:44:34
|
Hi. [Ted Berg] > > I have a java application that makes use of jython as a scripting engine. I > want to allow the end user to extend the functionality I provide by > dynamically loading module ( java or python ) at runtime. The java stuff is > working fine, but i'm running into a problem with the embedded python. > > runtime sys.path looks like this: > ['.', > '/home/tedberg/.javaws/cache/http/Djopenrpg.sourceforge.net/P80/DMfiles/RMjopenr pg.jar!Lib', > '/home/tedberg/.javaws/cache/http/Djopenrpg.sourceforge.net/P80/DMfiles/RMjopenr pg.jar!scripts', > '/home/tedberg/jopenrpg'] > > I can import python modules in the directories "Lib" and "scripts" that are > in the jar. What I *cannot* do, and *need* to do, is import modules in > "!scripts/pyhandlers". > > I have tried: > from scripts import pyhandlers > import scripts.pyhandlers Given your setup this is the one: > import pyhandlers have you an __init__.py or __init__$py.class there? regards. |
From: Ted B. <te...@et...> - 2001-09-26 19:09:38
|
I have a java application that makes use of jython as a scripting engine. I want to allow the end user to extend the functionality I provide by dynamically loading module ( java or python ) at runtime. The java stuff is working fine, but i'm running into a problem with the embedded python. runtime sys.path looks like this: ['.', '/home/tedberg/.javaws/cache/http/Djopenrpg.sourceforge.net/P80/DMfiles/RMjopenrpg.jar!Lib', '/home/tedberg/.javaws/cache/http/Djopenrpg.sourceforge.net/P80/DMfiles/RMjopenrpg.jar!scripts', '/home/tedberg/jopenrpg'] I can import python modules in the directories "Lib" and "scripts" that are in the jar. What I *cannot* do, and *need* to do, is import modules in "!scripts/pyhandlers". I have tried: from scripts import pyhandlers import scripts.pyhandlers import pyhandlers all of which return a "no module named" referencing scripts and pyhandlers respectively. Also: I can do a "import nodehandlers" ( nodehandlers is a dir in /home/tedberg/jopenrpg ), but I cannot import any modules *within* that directory.l What *am* I doing wrong? ted |
From: Mats W. <ma...@la...> - 2001-09-26 19:05:51
|
>Tnx for pointing out the wiki Frank. I do hope it becomes useful to folks. > >Just to clarify, the wiki is not for the book. The book is done, even >though it is not in print until December. There will be a website >associated with the book that should have additional ramblings that I >also hope are helpful. The wiki itself, however, is for my continued >work, which is future versions of Jython's online documentation. > >My previous mail (to Frank) was very unclear (that's a bad sign for a >supposed author! <wink> ). > >This is also a great time to invite people to add to the wiki. It's >in it's infancy, so there's lots of room for additions. The Wiki rather pointedly refers to having been set up in response to a burst of enthusiasm which seems to have dwindled to nothing for producing more thorough documentation. In my own case: guilty (on appearances) as charged. I've been wanting to write up several things, and ran into a period where I've had zero time. Now that I've been hovering around Jython for a while, mostly silently, I've noticed that new users crop up all the time and seem to follow this pattern: The first experiences with Jython are very easy (classpath problems notwithstanding...) - and the demos, various examples, Bruce Eckels' chapter, etc. all make it look great. Then you get into serious implementation and there's something that's unclear, or exposes something that "isn't CPython" or... My own experiences with converting/extending some Java code ran into confusion about inner classes, interfaces, etc. all of which in some sense are the Java designers' efforts to work around deficiencies in the language (note: that's an /opinion/, if it's not clear) and don't map perfectly onto Python semantics. This phase brings a burst of questions. After those are resolved, everything's rosy again. My hope would be that somehow we can get help for that set of second-level problems, but that's hard since very many of them seem to be "boundary conditons". I never found a place where the problems I ran into were described, but the lists were helpful in helping me understand the issues. My partial recoding, incidentally, turned into a redesign into "pure" Python over time... This is where pointing at the CPython docs doesn't help, and the existing Jython docs don't help much either. You can always ask on the lists and get a more interactive response, so perhaps that's okay - for now. If Jython grows much in popularity it may not be enough, esp. if people don't find their way to the lists. Hopefully, Robert's book will be able to do a lot of filling the need in this area! Mats |
From: Frank C. <fc...@pu...> - 2001-09-26 18:52:57
|
I posted a brief tutorial on creating and running Java objects from Jython. Jython is wonderfully easy to do this operation, even so I could have used some hand-holding while trying it the first time. The tutorial is posted on: http://www.jython.org/cgi-bin/moin.cgi/BriefTutorial and also: http://www.pushtotest.com/p2t/home.html?igid=G4039&mid=M4031&rid=R4&c=1 -Frank -- Frank Cohen, founder, PushToTest, www.pushtotest.com, phone: 408 374 7426 Come to PushToTest for Load, a free open-source tool for performance and scalability testing and data migration. |
From: R D. <rd...@cr...> - 2001-09-26 18:49:34
|
Thanks to all who helped me with my threading and list (silly!) questions. Now I have problems with distutils .. the distutils package doesn't seem to be part of the jython distribution, and i cant install the latest distutil package because it seems to depend on distutils. I tried just copying the directories under <context>/lib ... didn't work. Thanks Raj Datta Professional Services Direct : 408-530-4932 CrossAccess Corp Cell : 408-316-5473 2900 Gordon Ave #100 Fax : 408-735-0328 Santa Clara CA 95051 Email : rd...@cr... |
From: Robert W. B. <rb...@di...> - 2001-09-26 17:29:38
|
Hi all, On Wed, 26 Sep 2001, Frank Cohen wrote: > FYI: While learning Jython I found these links to have excellent information > on Jython: > > Robert Bill's book-in-progress on Jython: > http://www.jython.org/cgi-bin/moin.cgi/JythonDevelDocs Tnx for pointing out the wiki Frank. I do hope it becomes useful to folks. Just to clarify, the wiki is not for the book. The book is done, even though it is not in print until December. There will be a website associated with the book that should have additional ramblings that I also hope are helpful. The wiki itself, however, is for my continued work, which is future versions of Jython's online documentation. My previous mail (to Frank) was very unclear (that's a bad sign for a supposed author! <wink> ). This is also a great time to invite people to add to the wiki. It's in it's infancy, so there's lots of room for additions. Links to other Jython docs would be helpful (I've found a couple Jython pages in other languages, and I'd like to know what they are about). cheers, Robert > The JavaDoc for Jython is at: > http://www.jython.org./docs/api/overview-summary.html > > The PushToTest.com Jython discussion is at: > http://www.pushtotest.com/p2t/home.html?rid=R4&igid=G4039&c=1 > > Mark Lutz's Home Page (author of Programming Python): > http://www.rmi.net/~lutz > > Guido and Fred Drake Jr.'s Python Library Reference: > http://www.python.org/doc/lib/lib.html > > Python Tutorial by Fred Drake Jr: > http://www.python.org/doc/tut/tut.html > > -Frank |
From: Frank C. <fc...@pu...> - 2001-09-26 16:39:41
|
FYI: While learning Jython I found these links to have excellent information on Jython: Robert Bill's book-in-progress on Jython: http://www.jython.org/cgi-bin/moin.cgi/JythonDevelDocs The JavaDoc for Jython is at: http://www.jython.org./docs/api/overview-summary.html The PushToTest.com Jython discussion is at: http://www.pushtotest.com/p2t/home.html?rid=R4&igid=G4039&c=1 Mark Lutz's Home Page (author of Programming Python): http://www.rmi.net/~lutz Guido and Fred Drake Jr.'s Python Library Reference: http://www.python.org/doc/lib/lib.html Python Tutorial by Fred Drake Jr: http://www.python.org/doc/tut/tut.html -Frank -- Frank Cohen, founder, PushToTest, www.pushtotest.com, phone: 408 374 7426 Come to PushToTest for Load, a free open-source tool for performance and scalability testing and data migration. |
From: Robert W. B. <rb...@di...> - 2001-09-26 15:26:26
|
On Wed, 26 Sep 2001, John Goerzen wrote: > In Jython: > > Jython 2.1a3 on java1.1.8 (JIT: null) > Type "copyright", "credits" or "license" for more information. > >>> dir("") > [] An implementation quirk. If dir() doesn't reveal an object's methods, add ".__class__" to get a closer look. For example: >>> dir("".__class__) ['__add__', '__cmp__', '__complex__', '__contains__', '__len__', '__mod__', '__repr__', '__str__', 'alnum', 'alpha', 'capitalize', 'center', 'classDictInit', 'count', 'decimal', 'digit', 'encode', 'endswith', 'expandtabs', 'find', 'index','isalnum', 'isalpha', 'isdecimal', 'isdigit', 'islower', 'isnumeric', 'isspace', 'istitle', 'isunicode', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'numeric', 'replace', 'rfind', 'rindex', 'rjust', 'rstrip', 'space', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'unicode', 'upper', 'zfill'] > >>> ".".join(['1', '2', '3', '4']) > '1.2.3.4' > >>> dir([]) > ['append', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort'] > > In Python: > > Python 2.0.1 (#0, Jun 23 2001, 23:50:30) > [GCC 2.95.4 20010319 (Debian prerelease)] on linux2 > Type "copyright", "credits" or "license" for more information. > >>> dir("") > ['capitalize', 'center', 'count', 'encode', 'endswith', 'expandtabs', 'find', 'index', 'isalnum', 'isalpha', 'isdigit', 'islower', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'replace', 'rfind', 'rindex', 'rjust', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper'] > >>> ".".join(['1', '2', '3', '4']) > '1.2.3.4' > >>> dir([]) > ['append', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort'] > > Why is Jython's dir() not showing methods that clearly exist? The > last version of Python that didn't show those on dir("") didn't > actually have them. > > |
From: John G. <jgo...@co...> - 2001-09-26 13:40:16
|
In Jython: Jython 2.1a3 on java1.1.8 (JIT: null) Type "copyright", "credits" or "license" for more information. >>> dir("") [] >>> ".".join(['1', '2', '3', '4']) '1.2.3.4' >>> dir([]) ['append', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort'] In Python: Python 2.0.1 (#0, Jun 23 2001, 23:50:30) [GCC 2.95.4 20010319 (Debian prerelease)] on linux2 Type "copyright", "credits" or "license" for more information. >>> dir("") ['capitalize', 'center', 'count', 'encode', 'endswith', 'expandtabs', 'find', 'index', 'isalnum', 'isalpha', 'isdigit', 'islower', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'replace', 'rfind', 'rindex', 'rjust', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper'] >>> ".".join(['1', '2', '3', '4']) '1.2.3.4' >>> dir([]) ['append', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort'] Why is Jython's dir() not showing methods that clearly exist? The last version of Python that didn't show those on dir("") didn't actually have them. -- John Goerzen <jgo...@co...> GPG: 0x8A1D9A1F www.complete.org |
From: Lieyong Fu <LF...@Ce...> - 2001-09-26 03:20:54
|
With Jython-2.1a3, while trying to load Jython script from with BEA EJB, I've got the security permission error as attached even though I'had set the permission to jython.jar in the policy file. Any help is very much appreciated. java.lang.reflect.InvocationTargetException: Traceback (innermost last): (no code object) at line 0 java.security.AccessControlException: access denied (java.lang.RuntimePermission get ProtectionDomain ) at java.security.AccessControlContext.checkPermission(AccessControlContext.j ava, Compiled Code) at java.lang.Exception.<init>(Exception.java, Compiled Code) at java.lang.RuntimeException.<init>(RuntimeException.java, Compiled Code) at java.lang.SecurityException.<init>(SecurityException.java, Compiled Code) at java.security.AccessControlException.<init>(AccessControlException.java, Compiled Code) at java.security.AccessControlContext.checkPermission(AccessControlContext.j ava, Compiled Code) at java.security.AccessController.checkPermission(AccessController.java, Com piled Code) at java.lang.SecurityManager.checkPermission(SecurityManager.java, Compiled Code) at java.lang.Class.getProtectionDomain(Class.java:1231) at org.python.core.BytecodeLoader2.loadClassFromBytes(BytecodeLoader2.java) at org.python.core.BytecodeLoader.makeClass(BytecodeLoader.java, Compiled Co de) at org.python.core.BytecodeLoader.makeCode(BytecodeLoader.java) at org.python.core.Py.compile_flags(Py.java) at org.python.core.Py.compile_flags(Py.java) at org.python.core.Py.compile_flags(Py.java) at org.python.util.PythonInterpreter.exec(PythonInterpreter.java) at java.lang.reflect.Method.invoke(Native Method) at ProcessToJython.execMethod(ProcessToJython.java, Compiled Code) at ProcessToJython.runFile(ProcessToJython.java:103) at examples.ejb.basic.statelessSession.TraderBean.buy(TraderBean.java:118) at examples.ejb.basic.statelessSession.TraderBeanEOImpl.buy(TraderBeanEOImpl .java:105) at examples.ejb.basic.statelessSession.TraderBeanEOImpl_WLSkel.invoke(Trader BeanEOImpl_WLSkel.java:75) at weblogic.rmi.extensions.BasicServerObjectAdapter.invoke(BasicServerObject Adapter.java, Compiled Code) at weblogic.rmi.extensions.BasicRequestHandler.handleRequest(BasicRequestHan dler.java:77) at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.jav a:15) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, Compiled Code) java.security.AccessControlException: java.security.AccessControlException: access d enied (java.lang.RuntimePermission getProtectionDomain ) |
From: Ype K. <yk...@xs...> - 2001-09-25 17:55:44
|
Frank, Robert: About catching java.lang.OutOfMemError: when it is thrown from Java code (ie. from within the interpreter) I could not catch it using Jython 21a3. It was thrown while interpreting a jython function in infinite recursion. In the example I saw earlier, java.lang.OutOfMemError was thrown from within jython code, so it probably gets encapsulated into a Jython exception, allowing it to be caught in jython code. The code below allows you to execute a jython script from within jython, much as if it was called from a shell as an argument to the interpreter. Various sys things are adapted and restored and an evt. exception is returned. It also unloads modules, but it does not use jreload. I edited it a bit to clarify some names, and the indentation is probably affected by mail wrapping, but it should be easy to get it running. Have fun, Ype """ Execute python scripts from a search path (a set of directories). Allow the scripts to import modules from their own directory, from the script search path and from sys.path. Allow unloading of modules from the first directory on the search path, It is intended to use a local directory and a network directory, allowing for private (local) and shared script modules. In this way only private modules can be unloaded. All file names handled here are normalized: lower case is used and single backward slashes replace (sequences of) forward and backward slashes. (In jython 21a2 (1.1.8, OS2) sys.path contains a strange mix of upper and lower case.) Appropriate sys.argv, sys.path, and globals are set for the scripts. and sys.modules['__main__'] is adapted to the new module during its execution. The __name__ variable for the started script is set to '__main__'. Also sys.stdout (ie. print statements in scripts) is redirected during execution of scripts. An evt. exception from the script is caught and returned. Limitations. In jython 21a2 imported modules must have a lowercase .py extension. (Before 21a2 .PY uppercase was also ok. This is considered a bug and it is announced to be fixed in the next jython release.) In case the script goes into an infinite loop, the only way out is by closing the process, eg. from the process list. In case the script goes into infinite recursion, the process will terminates silently (OS2 JVM 1.1.8) when it runs out of stack. Unfortunately in Java it is not possible to limit the recursion depth, and it is not easy to provide a better alternative. In case too much memory is required for python data the process exits with a suggestion to use -mx to increase available memory. In both of these cases java.lang.Throwable is not caught, although the except: clause is there. Since both cases are allmost always caused by a bug in the executed script, it is recommended to inspect the suspect code, fix it and/or add some trace statements to locate the problem, and to try again. One alternative might be to trace all function calls and monitor the nr. of entries on the stack, but this would impose a large overhead in execution time. CPython allows to limit the recursion depth, Jython has no facility for this. Unloading of modules is done by removing the references in sys.modules. Actual unloading is left to the garbage collector. Better facilities may become available in Jython under Java 1.2 (see java class unloading in the Jython documentation.) Compiled modules ($py.class files for imported .py modules) contain their original path name. Therefore after renaming a package directory all its class files should be deleted, otherwise unloading might not be done correctly. The function sys.exc_info() is used in such a way that a circular reference would be created in CPython. Earlier versions of CPython might have problems when collecting this as garbage. """ import traceback, sys, os, time import java # java.lang.Throwable StartingScript__name__ = '__main__' from org.python.util import PythonInterpreter # Path handling from os.path import normpath, normcase, dirname doubleSep = os.sep + os.sep sepDot = os.sep + '.' # current working directory ends in '\\,' on sys.path (21a2, 1.1.8, OS2): not yet a problem sepDotSep = sepDot + os.sep if os.sep == '\\': otherSep = '/' else: otherSep = '\\' def normalPath(pathName): # OS2 version p = normpath(normcase(pathName.lower().replace(otherSep, os.sep))) while p[1:].find(doubleSep) >= 0: # replace multiple backslashes by single, except in front (network drives) p = p[0] + p[1:].replace(doubleSep, os.sep) return p PythonExtension = '.py' # Used for main programs only. # End of path handling. class ScriptExitException(Exception): pass class ScriptInterpreter: def __init__(self, scriptDirs, notUnloadDir, scriptGlobals, logFunc, printFunc): self.scriptDirs = [(normalPath(scriptDir) + os.sep) for scriptDir inscriptDirs] self.scriptUnloadDir = self.scriptDirs[0] # lower case required by self.UnloadModules() # to not unload modules of the script interpreter itself: self.notUnloadDir = normalPath(notUnloadDir) + os.sep self.scriptPathCache = {} self.scriptGlobals = scriptGlobals.copy() self.scriptGlobals['__name__'] = StartingScript__name__ self.logFunc = logFunc # log output from ScriptInterpreter self.printFunc = printFunc # used to redirect print statements from scripts, see below self.bufferedLine = None import new # replace sys.modules[StartingScript__name__] during execfile() self.mainModule = new.module(StartingScript__name__) # Note: self.mainModule.__dict__ should not be assigned to. def findScriptAndImportPaths(self, scriptName): """ for scriptName return tuple of full path name and system search path for importing modules """ if self.scriptPathCache.has_key(scriptName): # cache non normalized: faster most of the time return self.scriptPathCache[scriptName] scriptName = normalPath(scriptName) fileName = scriptName + PythonExtension for scriptPathDir in self.scriptDirs: scriptPath = scriptPathDir + fileName try: os.stat(scriptPath) except OSError: self.logFunc(scriptPath + ' not found.') else: scriptDir = dirname(scriptPath) + os.sep # maybe os.path.abspath() should be used. # for tracking down os.path.dirname() platform differences: # print repr(scriptPath), repr(scriptDir) if scriptDir in self.scriptDirs: # import always from own dir first: otherscriptDirs = self.scriptDirs[:] otherscriptDirs.remove(scriptDir) # returns None, cannot substitute below sysPath = [scriptDir] + otherscriptDirs + sys.path else: sysPath = [scriptDir] + self.scriptDirs + sys.path res = (scriptPath, sysPath) self.scriptPathCache[scriptName] = res return res sysPath = self.scriptDirs + sys.path # not found, use default res = (scriptPath, sysPath) self.scriptPathCache[scriptName] = res return res def executeScript(self, scriptName, scriptArgs): # returns evt. exception info, or None. #java.lang.OutOfMemoryError falls through. savedArgv = sys.argv[:] # sys.argv changed in place below savedPath = sys.path savedStdout = sys.stdout try: savedMainMod = sys.modules[StartingScript__name__] except KeyError: savedMainMod = None (sys.argv[0], sys.path) = self.findScriptAndImportPaths(scriptName) sys.argv[1:] = scriptArgs sys.stdout = self # see self.flush() and self.write(), redirect print statements from scripts statusMsg = 'Unknown exception, internal error.' try: try: scriptGlobals = self.mainModule.__dict__ # avoid the dot operators using a local var. scriptGlobals.clear() scriptGlobals.update(self.scriptGlobals) # (evt. add predefinitions for scripts to scriptGlobals at this point) sys.modules[StartingScript__name__] = self.mainModule # allow finding globals by module name # execfile() suggested by Finn Buck's email, Jan 2001 execfile(sys.argv[0], scriptGlobals) # execfile does not do any module administration except ScriptExitException: statusMsg = 'Exiting' exceptionInfo = None except Exception, e: # all other exceptions, including including script file not found. statusMsg = 'Exception: ' + str(e) exceptionInfo = sys.exc_info() except java.lang.Throwable, jt: # only used when running jython # Does not catch an actual java.lang.OutOfMemoryError (Jython 21a1, 21a2, 21a3). # Catches java.lang.NullPointerException happening after an # internal compiler error "Name:.... at line .." while importing a module # with an undefined name. 12-4-2001 (This seems to be a Jython 21a1 bug.) statusMsg = 'Java Throwable ' + str(jt) exceptionInfo = sys.exc_info() except: # Hopefully this catches very very unusual errors. (Never seen.) statusMsg = 'Deprecated exception.' # not derived from standard Exception exceptionInfo = sys.exc_info() ei = exceptionInfo # Show the exception in the log. maxDepth = 20 import linecache linecache.checkcache() # up to date code in the traceback tbText = ''.join(traceback.format_exception(ei[0], ei[1], ei[2], maxDepth)) sys.stdout = savedStdout # restore stdout before using self.logFunc() self.logFunc(tbText) # try and get info on the error also from the log else: statusMsg = 'Ending' exceptionInfo = None finally: # all exceptions should be caught, but anyway self.flush() if savedMainMod: sys.modules[StartingScript__name__] = savedMainMod else: del sys.modules[StartingScript__name__] sys.stdout = savedStdout sys.path = savedPath sys.argv = savedArgv return exceptionInfo # Note: Eventual exceptions raised by the code in this are not caught. def ExitScript(self): # should only be called during the execfile() in self.executeScript() raise ScriptExitException() def UnloadModules(self): """ remove from the modules loaded from self.scriptUnloadDir, and clear self.scriptPathCache """ self.scriptPathCache.clear() scriptUnloadDirLen = len(self.scriptUnloadDir) namesMods = sys.modules.items() namesMods.sort() namesMods.reverse() # delete packages after the modules they contain. for modName, mdl in namesMods: # iterate copy, remove from original below. if hasattr(mdl, '__file__'): fileName = mdl.__file__.replace(sepDotSep, os.sep).lower() if fileName.startswith(self.scriptUnloadDir) and not fileName.startswith(self.notUnloadDir): self.logFunc('Unloading module ' + modName + ' (' + fileName + ')') del sys.modules[modName] # remove the reference, actual unloading left to garbage collection. # maintain self.bufferedLine for self.write() and self.flush() def appendToBufLine(self, text): if self.bufferedLine is None: self.bufferedLine = text elif text: self.bufferedLine += text # as sys.stdout def flush(self): if self.bufferedLine is not None: self.printFunc(self.bufferedLine) self.bufferedLine = None def write(self, text): if len(text) and text.endswith('\n'): line = text[:-1] assert line.find('\n') == -1, "line should be split at ends of lines" # CHECKME self.appendToBufLine(line) self.flush() else: self.appendToBufLine(text) |
From: Mark R. <blo...@ho...> - 2001-09-25 15:39:39
|
Hey guys, can anyone advise a stratagy for the following situation: I have a dialog window which contains a number of fields. Each field is initialised with a valid default value, and is associated with a focusListener. If, a user modifies a field, a validation method is called when focusLost is detected for that field(textbox or what not). So far so good, everything works. However, I would like for the user to be able to cancel, regardless of whether or not any fields contain an invalid value. With this in mind I associated a mouseListener to my cancel button, but The problem is that focuslost() seems to be given priority over everything else. Focuslost is detected before mouse clicked over button which I find surprising (how did it know it was losing focus before the button had registered a click). I figure this must be a fairly common situation and there is probably some well defined (and probably obvious) way to deal with it. So, if anyone can lend me some fatherly/motherly advice I'd really appreciate it. cheers blobby _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp |
From: Bruce M. <bmc...@in...> - 2001-09-24 20:14:42
|
Hi Kevin, I believe you are trying set something that doesn't exist yet. In the first iteration, you are setting conlist[0], but conlist[0] doesn't exist yet. As suggested previously, you need to append the values to the list, then you can reference them. Thx, Bruce -----Original Message----- From: Kevin Butler [mailto:kb...@ca...] Sent: Monday, September 24, 2001 1:02 PM To: R Datta Cc: jyt...@li... Subject: Re: [Jython-users] List issue R Datta wrote: > 40 conlist= [] > 41 for i in xrange(threadCount): > 42 url = "jdbc:mysql://%s/%s?user=%s&password=%s" % (server, db, > usr, passwd) > 43 print "Connection # ",i > 44 conlist[i]=DriverManager.getConnection(url) > 45 sleep(0.5) > > It gives me the following error: > Connection # 0 > Traceback (innermost last): > File "cxjdbcThread1.py", line 44, in ? > IndexError: index out of range: -1 > > I must be making some very obvious mistake, but I can't find it. Yes. :-) There is no item at conlist[0] to replace via that assignment. Try "conlist.append( ... )" or "conlist.insert( 0, ... )" > If there > is a better (more efficient) way of storing the connection objects, pls > tell me. If you're just talking memory efficiency, you may want to put them in a dictionary (Map), with the thread that is using them as a key. You may want to use a Java WeakHashMap to ensure that threads & connections can be garbage collected when the thread terminates. If you want time efficiency, you probably don't want the sleep() or the print. And you should move the string formatting outside the loop, and possibly store a local reference to the append method: a = conlist.append for... a( DriverManager.getConnection(url) ) If you really want to max it out, you could do something like the following: url = "jdbc:mysql://%s/%s?user=%s&password=%s" % (server, db, usr, passwd) conlist = [url]*threadCount conlist = map( DriverManager.getConnection, conlist ) This builds the URL once, and moves the iteration & method invocation into native Java code, but has the cost of creating two lists of length=threadCount, instead of just one. Of course, this type of micro-optimization will be completely masked by the overhead of creating JDBC connections, but it may be applicable in other code... YMMV. kb _______________________________________________ Jython-users mailing list Jyt...@li... https://lists.sourceforge.net/lists/listinfo/jython-users |
From: Kevin B. <kb...@ca...> - 2001-09-24 20:02:33
|
R Datta wrote: > 40 conlist= [] > 41 for i in xrange(threadCount): > 42 url = "jdbc:mysql://%s/%s?user=%s&password=%s" % (server, db, > usr, passwd) > 43 print "Connection # ",i > 44 conlist[i]=DriverManager.getConnection(url) > 45 sleep(0.5) > > It gives me the following error: > Connection # 0 > Traceback (innermost last): > File "cxjdbcThread1.py", line 44, in ? > IndexError: index out of range: -1 > > I must be making some very obvious mistake, but I can't find it. Yes. :-) There is no item at conlist[0] to replace via that assignment. Try "conlist.append( ... )" or "conlist.insert( 0, ... )" > If there > is a better (more efficient) way of storing the connection objects, pls > tell me. If you're just talking memory efficiency, you may want to put them in a dictionary (Map), with the thread that is using them as a key. You may want to use a Java WeakHashMap to ensure that threads & connections can be garbage collected when the thread terminates. If you want time efficiency, you probably don't want the sleep() or the print. And you should move the string formatting outside the loop, and possibly store a local reference to the append method: a = conlist.append for... a( DriverManager.getConnection(url) ) If you really want to max it out, you could do something like the following: url = "jdbc:mysql://%s/%s?user=%s&password=%s" % (server, db, usr, passwd) conlist = [url]*threadCount conlist = map( DriverManager.getConnection, conlist ) This builds the URL once, and moves the iteration & method invocation into native Java code, but has the cost of creating two lists of length=threadCount, instead of just one. Of course, this type of micro-optimization will be completely masked by the overhead of creating JDBC connections, but it may be applicable in other code... YMMV. kb |
From: O'Brien-Strain, E. <eo...@ex...> - 2001-09-24 19:56:10
|
Instead of "conlist[i] = x" you can use "conlist.append(x)" __ Eamonn O'Brien-Strain HP Labs eo...@hp... > -----Original Message----- > From: R Datta [mailto:rd...@cr...] > Sent: Monday, September 24, 2001 12:23 PM > To: jyt...@li... > Subject: [Jython-users] List issue > > > Guys, > > I am trying to create a pool of JDBC connections, storing > them in a list > called conlist. Here is the relevant snippet. > > 40 conlist= [] > 41 for i in xrange(threadCount): > 42 url = "jdbc:mysql://%s/%s?user=%s&password=%s" % > (server, db, > usr, passwd) > 43 print "Connection # ",i > 44 conlist[i]=DriverManager.getConnection(url) > 45 sleep(0.5) > > It gives me the following error: > Connection # 0 > Traceback (innermost last): > File "cxjdbcThread1.py", line 44, in ? > IndexError: index out of range: -1 > > I must be making some very obvious mistake, but I can't find > it. If there > is a better (more efficient) way of storing the connection > objects, pls > tell me. > Please help! > > Thanks > Raj Datta > Professional Services Direct : > 408-530-4932 > CrossAccess Corp Cell : > 408-316-5473 > 2900 Gordon Ave #100 Fax : 408-735-0328 > Santa Clara CA 95051 Email : > rd...@cr... > > > _______________________________________________ > Jython-users mailing list > Jyt...@li... > https://lists.sourceforge.net/lists/listinfo/jython-users > |
From: brian z. <bz...@zi...> - 2001-09-24 19:44:12
|
You can not insert into a python list if it is not sized sufficiently, instead try: 44 conlist.append(DriverManager.getConnection(url)) brian ----- Original Message ----- From: "R Datta" <rd...@cr...> To: <jyt...@li...> Sent: Monday, September 24, 2001 2:23 PM Subject: [Jython-users] List issue > Guys, > > I am trying to create a pool of JDBC connections, storing them in a list > called conlist. Here is the relevant snippet. > > 40 conlist= [] > 41 for i in xrange(threadCount): > 42 url = "jdbc:mysql://%s/%s?user=%s&password=%s" % (server, db, > usr, passwd) > 43 print "Connection # ",i > 44 conlist[i]=DriverManager.getConnection(url) > 45 sleep(0.5) > > It gives me the following error: > Connection # 0 > Traceback (innermost last): > File "cxjdbcThread1.py", line 44, in ? > IndexError: index out of range: -1 > > I must be making some very obvious mistake, but I can't find it. If there > is a better (more efficient) way of storing the connection objects, pls > tell me. > Please help! > > Thanks > Raj Datta > Professional Services Direct : 408-530-4932 > CrossAccess Corp Cell : 408-316-5473 > 2900 Gordon Ave #100 Fax : 408-735-0328 > Santa Clara CA 95051 Email : rd...@cr... > > > _______________________________________________ > Jython-users mailing list > Jyt...@li... > https://lists.sourceforge.net/lists/listinfo/jython-users |
From: R D. <rd...@cr...> - 2001-09-24 19:23:31
|
Guys, I am trying to create a pool of JDBC connections, storing them in a list called conlist. Here is the relevant snippet. 40 conlist= [] 41 for i in xrange(threadCount): 42 url = "jdbc:mysql://%s/%s?user=%s&password=%s" % (server, db, usr, passwd) 43 print "Connection # ",i 44 conlist[i]=DriverManager.getConnection(url) 45 sleep(0.5) It gives me the following error: Connection # 0 Traceback (innermost last): File "cxjdbcThread1.py", line 44, in ? IndexError: index out of range: -1 I must be making some very obvious mistake, but I can't find it. If there is a better (more efficient) way of storing the connection objects, pls tell me. Please help! Thanks Raj Datta Professional Services Direct : 408-530-4932 CrossAccess Corp Cell : 408-316-5473 2900 Gordon Ave #100 Fax : 408-735-0328 Santa Clara CA 95051 Email : rd...@cr... |
From: Ted B. <te...@et...> - 2001-09-23 23:21:48
|
On Friday 21 September 2001 23:27, Frank Cohen wrote: > I've been looking into the OpenSSL project. Do you know if they are the > providers of the JDK 1.4 SSL? > > -Frank I don't know, no. the 1.4 ssl stuff is in the package javax.net.ssl, IIRC. I'd imagine that it would be named differently if it were developed by someone other than Sun. ted |
From: Robert W. B. <rb...@di...> - 2001-09-23 15:36:37
|
On Sun, 23 Sep 2001, Ype Kingma wrote: > Robert, > > >On Sat, 22 Sep 2001, Frank Cohen wrote: > >> Thanks for the great reply. Lots of useful information here. I would > >> appreciate seeing your example code too. > >> > >> Do I have it right that Jython can't catch Java exceptions? > > > >Actually, Jython does catch Java exceptions. e.g.: > > > >>>> import java > >>>> try: > >... raise java.lang.UnknownError, "Java error raised" > >>>> except java.lang.UnknownError: > >... print "Java exception caught" > >... > >Java exception caught > >>>> > > > >It catches it just the same if a Java class throws it. > > Could you try java.lang.OutOfMemError, too? It's already some versions > of jython ago that I could not catch it in actual out of memory situations. > > Ype. ------------------------------------ >>> import java >>> try: ... raise java.lang.OutOfMemoryError ... except java.lang.OutOfMemoryError: ... print "Caught" ... Caught >>> ------------------------------------ The above works, but I know it's not what you are getting at. The complication of the System.exit(-1) in Py.MemoryError(OutOfMemoryError t) (file org/python/core/Py.java) is what you're referring to, isn't it? You're asking about something closer to the following: ------------------------------------- >>> import java >>> from org.python.core import Py >>> e = java.lang.OutOfMemoryError() >>> try: ... Py.MemoryError(e) ... except: ... import sys ... x = sys.exc_info() ... Out of Memory You might want to try the -mx flag to increase heap size ------------------------------------- Yes, that makes for a problem trying to catch the OutOfMemoryError. I think the difference between an error and an exception helps here. An Error is tough (likely impossible) to recover from, and javadocs even say an error "indicates serious problems that a reasonable application should not try to catch." -rb |
From: Ype K. <yk...@xs...> - 2001-09-23 08:57:22
|
Robert, >On Sat, 22 Sep 2001, Frank Cohen wrote: >> Thanks for the great reply. Lots of useful information here. I would >> appreciate seeing your example code too. >> >> Do I have it right that Jython can't catch Java exceptions? > >Actually, Jython does catch Java exceptions. e.g.: > >>>> import java >>>> try: >... raise java.lang.UnknownError, "Java error raised" >>>> except java.lang.UnknownError: >... print "Java exception caught" >... >Java exception caught >>>> > >It catches it just the same if a Java class throws it. Could you try java.lang.OutOfMemError, too? It's already some versions of jython ago that I could not catch it in actual out of memory situations. Ype. |
From: Robert W. B. <rb...@di...> - 2001-09-22 22:18:00
|
Hello Nagar, Try compiling with: jythonc --all --jar test.jar test.py Then add test.jar to the applet tag. -rb On Sat, 22 Sep 2001, rupesh nagar wrote: > hi, > I am a newie to jython and have made a applet. I compiled and got .class > and .java files. I can see the applet using 'jython test.py' > in an AWT tester, however when I try to see it in appletviewer it > gives me the following message > ********************************************************** > java.lang.NoClassDefFoundError: org/python/core/PyProxy > at java.lang.ClassLoader.defineClass0(Native Method) > at java.lang.ClassLoader.defineClass(ClassLoader.java:486) > at > java.security.SecureClassLoader.defineClass(SecureClassLoader.java:1 > 1) > at > sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:142) > at java.lang.ClassLoader.loadClass(ClassLoader.java:297) > at > sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:108) > at java.lang.ClassLoader.loadClass(ClassLoader.java:253) > at sun.applet.AppletClassLoader.loadCode(AppletClassLoader.java:366) > at sun.applet.AppletPanel.createApplet(AppletPanel.java:579) > at sun.applet.AppletPanel.runLoader(AppletPanel.java:515) > at sun.applet.AppletPanel.run(AppletPanel.java:293) > at java.lang.Thread.run(Thread.java:484) > ********************************************************* > > Please let me know where am I wrong. > > thanks, > Nagar > > _________________________________________________________________ > Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp > > > _______________________________________________ > Jython-users mailing list > Jyt...@li... > https://lists.sourceforge.net/lists/listinfo/jython-users > |
From: Robert W. B. <rb...@di...> - 2001-09-22 22:12:37
|
On Sat, 22 Sep 2001, Frank Cohen wrote: > Thanks for the great reply. Lots of useful information here. I would > appreciate seeing your example code too. > > Do I have it right that Jython can't catch Java exceptions? Actually, Jython does catch Java exceptions. e.g.: >>> import java >>> try: ... raise java.lang.UnknownError, "Java error raised" >>> except java.lang.UnknownError: ... print "Java exception caught" ... Java exception caught >>> It catches it just the same if a Java class throws it. -robert |
From: rupesh n. <rup...@ho...> - 2001-09-22 20:11:32
|
hi, I am a newie to jython and have made a applet. I compiled and got .class and .java files. I can see the applet using 'jython test.py' in an AWT tester, however when I try to see it in appletviewer it gives me the following message ********************************************************** java.lang.NoClassDefFoundError: org/python/core/PyProxy at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:486) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:1 1) at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:142) at java.lang.ClassLoader.loadClass(ClassLoader.java:297) at sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:108) at java.lang.ClassLoader.loadClass(ClassLoader.java:253) at sun.applet.AppletClassLoader.loadCode(AppletClassLoader.java:366) at sun.applet.AppletPanel.createApplet(AppletPanel.java:579) at sun.applet.AppletPanel.runLoader(AppletPanel.java:515) at sun.applet.AppletPanel.run(AppletPanel.java:293) at java.lang.Thread.run(Thread.java:484) ********************************************************* Please let me know where am I wrong. thanks, Nagar _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp |
From: Frank C. <fc...@pu...> - 2001-09-22 15:11:28
|
Thanks for the great reply. Lots of useful information here. I would appreciate seeing your example code too. Do I have it right that Jython can't catch Java exceptions? If so, should I implement my Java code to catch and store all exceptions and have a geterror method that returns a thrown error code to the Jython script? -Frank -- Frank Cohen, founder, PushToTest, www.pushtotest.com, phone: 408 374 7426 Come to PushToTest for Load, a free open-source tool for performance and scalability testing and data migration. > From: Ype Kingma <yk...@xs...> > Date: Sat, 22 Sep 2001 11:09:01 +0100 > To: jyt...@li... > Subject: Re: [Jython-users] exec and globals > > Frank, > >> If anyone will confirm this is the best way to use exec and globals, I would >> certain appreciate your feedback. >> >> The goal is to have the Jython equivalent of server-side include files where >> one script calls another and can share variables. In an experiment I created >> two files: >> >> exec_example.py >> >> def makethecall: >> i=100 >> exec open("included.py").read() >> print "j=", j >> makethecall() >> >> >> included.py >> >> j=101 >> print "i=", i >> >> By running exec_example I see: >> >> i=100 >> j=101 >> >> Is this the best way to have scripts calling other scripts and returning >> results? > > This illustrates that the global namespace passed to exec is the local > namespace of the makethecall function. > You can have more control over the namespaces passed to exec by passing > these as arguments, too. My guess is that you are going to need this. > In this particular example I think I'd prefer to use execfile(), but > that is rather minor. > > You could also note that: > - the __name__ variable in the executed code will have the value of the > __name__ variable at the exec call, which might not be desirable. > - the function makethecall is defined when included.py is exec'ed, > > There are a few other things that are normally provided by jython > itself for the code it executes that you might want to consider: > > In case you want to control import's in exec'ed code: > - sys.modules might change during the exec when the executed code imports > other modules. > - neither exec nor execfile does any module administration in > sys.modules. You can do this yourself by (temporarily) adding > a new.module() to sys.modules. > In case you want more control over imports in executed code you'll need to > control sys.path too, as it determines the places from which modules can > be loaded. > > The exec'ed code might throw > - a jython exception. You might want to catch it. > - a java exception that you cannot catch in jython. > > The exec'ed code might not return. This is rather hard to control, > but it is possible in jython by using a (deprecated) java call to stop > the thread doing the exec. Fortunately the python language does not > encourage writing endless loops. > > The nice thing about python/jython is that you can control almost all > of these aspects when using exec or execfile. > The downside is off course that you might have to write the code to do > some of this. If you'd like to see an example, let me know. > > Regards, > Ype > > _______________________________________________ > Jython-users mailing list > Jyt...@li... > https://lists.sourceforge.net/lists/listinfo/jython-users |