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: Samuele P. <pe...@in...> - 2001-08-10 14:15:18
|
Sorry for answering only now > > I am running multiple processes using jython2.0 in NFS. These processes may > have different python paths but use the same cache dir and access the same > files there. Is there any danger these processes will clobber each other and > produce unpredictable results, i.e. using a wrong package? What exactly > would a Package Manager do in this case? Thanks. > > Jesse Liu > I would say, that it is better to use separate cache dir if your process access new jars sometime, there is no concurrency control for cache accesses, OTOH if the set of accessed jar is someone fixed then the cache (once setup) is used just in read-only mode and there should be no problem. regards, Samuele Pedroni. |
From: Samuele P. <pe...@in...> - 2001-08-10 13:22:55
|
My bad, > > > > There are three ways I can think of... > > > > 1) subclass PackageManager > Note: This is also used for java pkgs/classes imports ^meant: ONLY > > > 2) write your own import function > > 3) (related to 2) query the database and then exec the string in the > > appropriate namespace > |
From: Samuele P. <pe...@in...> - 2001-08-10 13:13:22
|
Hi. > > > There are three ways I can think of... > > 1) subclass PackageManager Note: This is also used for java pkgs/classes imports > 2) write your own import function > 3) (related to 2) query the database and then exec the string in the > appropriate namespace regards, Samuele Pedroni |
From: Paolo T. <Pao...@ma...> - 2001-08-10 08:24:41
|
Hi. In our project we have to invoke jython scripts from a C++ process. This jython scripts are for unti test and then the C++ process has to verify the result of the jython scripts. So, the problem seems to be how making communication between C++ process and jvm process (jython). The only way to be done seems to test the result of the jvm process as unix process; in other words, the script jython should terminate with the exit system call equals to zero or one (exit(1) or exit (0) ) and the C++ process tests it. Anyone knows any other possible solutions ? Is it possible to invoke in some way a jython script from a python script and testing back the result ? I think there is no other solution than the first one depicted above, otherwise .. any helps is appreciate. Thank you in advance. Paolo. |
From: <bc...@wo...> - 2001-08-10 06:07:12
|
[Peter Brinkmann] >I installed jython-2.1a3 in order to get the bug fix for the os package. >The package os works fine now, but I've discovered a new problem, this >time related to jythonc 2.1a3. > >[...] 1 ././pbj/jpy/GUIFactory.java:731: Superclass pbj.jpy.pbj.jpy.GUIFactory.QDialog of nested class pbj.jpy.GUIFactory. TDialog not found. > public static class TDialog extends pbj.jpy.pbj.jpy.GUIFactory.QDialog implements org.python.core.PyProxy, org.python.core.ClassDictInit { > ^ > Note: 4 files use or override a deprecated API. Recompile with "-deprecation" for details. > 1 error, 1 warning > > ERROR DURING JAVA COMPILATION... EXITING > >The problem is the line 'TDialog extends pbj.jpy.pbj.jpy.GUIFactory.QDialog'. >I haven't tried to reproduce the problem with a small amount of code. Please try to make an example. And add a bug report about it. >For the time being I've fixed it by simply reverting to jython-2.0. Thats ok. The alpha and betas are mainly meant for testing. regards, finn |
From: <bc...@wo...> - 2001-08-10 05:56:49
|
[Peter Brinkmann] >Here's the reason why I'm interested in the kind of code I posted. >I would like to create a number of classes that share the same >factory (after Gang of Four: "Design Patterns") for creating certain >objects. Ordinarily, one would pass a factory as a parameter when >constructing an object. In this case, however, I would like to >_derive_ a class from another class that's provided by the factory, >so passing the factory as a parameter won't work. > >The solution I have in mind works like this: Create an initially >empty module, call it init. The module that determines the concrete >factory imports init and assigns the factory to this module as >a module-global variable, say init.factory. At runtime? >Then the modules that >use this factory import init and work with init.factory (or derive >classes from init.factory.someClass). Remember that init.factory.someClass must be bound to one java class at compile time to make static subclassing work. >I'm not sure whether this is the best possible solution to the problem, >but it is fairly simple and it works. The only drawback I see right now >is that it requires compiler classes in jar files. If init.factory.someClass can change between different runs, then you need the compiler classes. >> OTOH the example you showed isn't more complicated than jythonc should >> be able to detect that init.cl is java class. Please add bug report >> about it. > >I agree that it would be unreasonable to expect jythonc to track the class >of any given variable. I do, however, think that a little more tracking >would be helpful. I've managed to further condense my examples in order >to illustrate the point. > >The following example works, even when compiled and packaged without >compiler classes. >---------------------- example1.py --------------------------- >import java > >cl=java.lang.Object > >class spam(cl): > pass >-------------------------------------------------------------- It also assumes that cl isn't changed later on. Normally the assumtion holds. >The next example does _not_ work without compiler classes. >---------------------- example2.py -------------------------- >import java >import init # any module, can be empty > >init.cl=java.lang.Object > >class spam(init.cl): > pass >-------------------------------------------------------------- > >It appears that jythonc does not track classes across module boundaries, >even though this kind of tracking shouldn't be too difficult in this case. It is beginning to look like some other module could make changes to init.cl, say bind it java.util.Date. If we improved the tracking, such a rebinding would have no effect. The java.lang.Object would always be used as superclass to spam. >I think this behavior might qualify as a bug; after all, the two programs >listed above are pretty much the same, so it seems reasonable to expect >them to behave in the same way. Any thoughts? I don't mind calling it a bug. Please add a bugreport with the all the examples you have shown. Just be sure that you know and understand the static nature of a jythonc compiled program. regards, finn |
From: Peter B. <bri...@ma...> - 2001-08-10 02:41:16
|
Hi! I installed jython-2.1a3 in order to get the bug fix for the os package. The package os works fine now, but I've discovered a new problem, this time related to jythonc 2.1a3. Here's what I get when compiling a rather large project with jythonc 2.0: jythonc --package pbj.jpy --jar pbjmin.jar --deep --all \ --addpackages pbj,gnu --workdir . pbjp/pbjapp.py processing pbjapp [...] Creating .java files: [...] GUIFactory module TDialog extends QDialog QDialog extends java.awt.Dialog FDialog extends java.awt.FileDialog [...] Here's what I get when compiling the same project with jythonc 2.1a3: /usr/local/jython-2.1a3/jythonc --package pbj.jpy --jar pbjmin.jar \ --deep --all --addpackages pbj,gnu --workdir . pbjp/pbjapp.py processing pbjapp [...] GUIFactory module TDialog extends pbj.jpy.pbj.jpy.GUIFactory.QDialog QDialog extends java.awt.Dialog FDialog extends java.awt.FileDialog [...] Compiling .java to .class... [...] 1 ././pbj/jpy/GUIFactory.java:731: Superclass pbj.jpy.pbj.jpy.GUIFactory.QDialog of nested class pbj.jpy.GUIFactory. TDialog not found. public static class TDialog extends pbj.jpy.pbj.jpy.GUIFactory.QDialog implements org.python.core.PyProxy, org.python.core.ClassDictInit { ^ Note: 4 files use or override a deprecated API. Recompile with "-deprecation" for details. 1 error, 1 warning ERROR DURING JAVA COMPILATION... EXITING The problem is the line 'TDialog extends pbj.jpy.pbj.jpy.GUIFactory.QDialog'. I haven't tried to reproduce the problem with a small amount of code. For the time being I've fixed it by simply reverting to jython-2.0. Best, Peter |
From: Tom W. <to...@ss...> - 2001-08-09 22:36:24
|
I've run into a situation where I want to: from visad.data.mcidas import PointData and there is an object named "visad.Data" which is confusing the class loader somewhere along the line (big stack trace follows...sorry). I cannot change the names in this library, so I'm hoping someone has a suggestion as to how I can work around this. I've tried some permutations, but nothing seems to work via Jython. I'm running Windoz and Jython 2.0. Sorry if this has been answered before, but a bit of searching did not turn up anything... Thanks... tom ============== D:\src\visad\python>jy profiler.py Traceback (innermost last): File "profiler.py", line 4, in ? java.lang.NoClassDefFoundError: visad/data (wrong name: visad/Data) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:486) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:11 1) at java.net.URLClassLoader.defineClass(URLClassLoader.java:248) at java.net.URLClassLoader.access$100(URLClassLoader.java:56) at java.net.URLClassLoader$1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:297) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:286) at java.lang.ClassLoader.loadClass(ClassLoader.java:253) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:120) at org.python.core.SyspathJavaLoader.loadClass(SyspathJavaLoader.java:57 ) at java.lang.ClassLoader.loadClass(ClassLoader.java:253) at org.python.core.Py.findClassEx(Py.java:607) at org.python.core.SysPackageManager.findClass(SysPackageManager.java:91 ) at org.python.core.PackageManager.findClass(PackageManager.java:19) at org.python.core.SysPackageManager.findClass(SysPackageManager.java:83 ) at org.python.core.PyJavaPackage.__findattr__(PyJavaPackage.java:128) at org.python.core.PyObject.impAttr(PyObject.java:633) at org.python.core.imp.dottedFind(imp.java:412) at org.python.core.imp.importName(imp.java:436) at org.python.core.imp.importName(imp.java:509) at org.python.core.ImportFunction.load(__builtin__.java:967) at org.python.core.ImportFunction.__call__(__builtin__.java:961) at org.python.core.PyObject.__call__(PyObject.java:250) at org.python.core.__builtin__.__import__(__builtin__.java:921) at org.python.core.imp.importAll(imp.java:592) at org.python.pycode._pyx0.f$0(profiler.py) at org.python.pycode._pyx0.call_function(profiler.py) at org.python.core.PyTableCode.call(PyTableCode.java:155) at org.python.core.Py.runCode(Py.java:1055) at org.python.core.__builtin__.execfile(__builtin__.java:288) at org.python.core.__builtin__.execfile(__builtin__.java:292) at org.python.util.PythonInterpreter.execfile(PythonInterpreter.java:155 ) at org.python.util.jython.main(jython.java:159) java.lang.NoClassDefFoundError: java.lang.NoClassDefFoundError: visad/data (wron g name: visad/Data) ==================== -- Tom Whittaker (to...@ss...) University of Wisconsin-Madison Space Science and Engineering Center Phone/VoiceMail: 608/262-2759 Fax: 608/262-5974 |
From: Glen S. <gl...@en...> - 2001-08-09 22:28:49
|
On Thursday 09 August 2001 15:11, David Dunkle wrote: > I would like to be able to import a Python module but > not from a file. For example, I may want to store Python source > in an RDBMS and import it without the file system being involved. > > From Java I would do this with by writing a classloader as part of > my application. How can I do this with Jython? > > I realize that I could probably subclass PackageManager and roll > my own. Is there a better way? Has anyone already solved this > problem? > > thanks, > David There are three ways I can think of... 1) subclass PackageManager 2) write your own import function 3) (related to 2) query the database and then exec the string in the appropriate namespace -- Glen Starchman The Enabled Technology Group >+++++++++[<++++++++>-]<.>++++++ [<+++++>-]<-.+++++++..+++. |
From: dman <ds...@ri...> - 2001-08-09 22:28:01
|
On Thu, Aug 09, 2001 at 03:11:11PM -0700, David Dunkle wrote: | I would like to be able to import a Python module but | not from a file. For example, I may want to store Python source | in an RDBMS and import it without the file system being involved. | | From Java I would do this with by writing a classloader as part of | my application. How can I do this with Jython? | | I realize that I could probably subclass PackageManager and roll | my own. Is there a better way? Has anyone already solved this | problem? Define a function that will implement the import operation. ----------------------------- Python 2.1 (#1, Apr 17 2001, 09:45:01) [GCC 2.95.3-2 (cygwin special)] on cygwin_nt-4.01 Type "copyright", "credits" or "license" for more information. >>> import __builtin__ >>> print __builtin__.__import__.__doc__ __import__(name, globals, locals, fromlist) -> module Import a module. The globals are only used to determine the context; they are not modified. The locals are currently unused. The fromlist should be a list of names to emulate ``from name import ...'', or an empty list to emulate ``import name''. When importing a module from a package, note that __import__('A.B', ...) returns package A when fromlist is empty, but its submodule B when fromlist is not empty. >>> ----------------------------- Suppose I wanted to add printing out the package/module name to the import : # get access to the builtin stuff import __builtin__ # save a reference to the original implementation orig_import = __builtin__.__import__ # define how I want to import def my_cust_import( name , globals , locals , fromlist ) : print "Importing '%s' now" % name return orig_import( name , globals , locals , fromlist ) # make python use my import instead __builtin__.__import__ = my_cust_import HTH, -D |
From: Peter B. <bri...@ma...> - 2001-08-09 22:27:37
|
Finn: > Jythonc attempt to track the flow of name bindings of classes at > compilation time. Usually this tracking doesn't have to perfect to be > usefull in real life and so far I haven't been a need like yours. Here's the reason why I'm interested in the kind of code I posted. I would like to create a number of classes that share the same factory (after Gang of Four: "Design Patterns") for creating certain objects. Ordinarily, one would pass a factory as a parameter when constructing an object. In this case, however, I would like to _derive_ a class from another class that's provided by the factory, so passing the factory as a parameter won't work. The solution I have in mind works like this: Create an initially empty module, call it init. The module that determines the concrete factory imports init and assigns the factory to this module as a module-global variable, say init.factory. Then the modules that use this factory import init and work with init.factory (or derive classes from init.factory.someClass). I'm not sure whether this is the best possible solution to the problem, but it is fairly simple and it works. The only drawback I see right now is that it requires compiler classes in jar files. > OTOH the example you showed isn't more complicated than jythonc should > be able to detect that init.cl is java class. Please add bug report > about it. I agree that it would be unreasonable to expect jythonc to track the class of any given variable. I do, however, think that a little more tracking would be helpful. I've managed to further condense my examples in order to illustrate the point. The following example works, even when compiled and packaged without compiler classes. ---------------------- example1.py --------------------------- import java cl=java.lang.Object class spam(cl): pass -------------------------------------------------------------- The next example does _not_ work without compiler classes. ---------------------- example2.py -------------------------- import java import init # any module, can be empty init.cl=java.lang.Object class spam(init.cl): pass -------------------------------------------------------------- It appears that jythonc does not track classes across module boundaries, even though this kind of tracking shouldn't be too difficult in this case. I think this behavior might qualify as a bug; after all, the two programs listed above are pretty much the same, so it seems reasonable to expect them to behave in the same way. Any thoughts? Best, Peter |
From: David D. <dav...@ep...> - 2001-08-09 22:11:56
|
I would like to be able to import a Python module but not from a file. For example, I may want to store Python source in an RDBMS and import it without the file system being involved. From Java I would do this with by writing a classloader as part of my application. How can I do this with Jython? I realize that I could probably subclass PackageManager and roll my own. Is there a better way? Has anyone already solved this problem? thanks, David |
From: Garcia, M. <mg...@Bu...> - 2001-08-09 20:42:29
|
If you are using the Xerces API this is easy to do in Jython. Assuming you are using a DOMParser try this: ##I'm reading my xml from a file and using a CharArrayReader >>> charArryRdr = CharArrayReader(charArry) >>> from org.xml.sax import * >>> inSource = InputSource(charArryRdr) >>> parser org.apache.xerces.parsers.DOMParser@43e3fb >>> parser.parse(inSource) >>> doc = parser.getDocument() >>> doc [#document: null] >>> root = doc.getDocumentElement() >>> root [Portfolio_Builder: null] >>> nodeLst = root.getElementsByTagName('Portfolio_Breakdown') >>> nodeLst org.apache.xerces.dom.DeepNodeListImpl@79e328 >>> nodeLst.getLength() 1 >>> node = nodeLst.item(0) >>> node [Portfolio_Breakdown: null] >>> children = node.getChildNodes() >>> children.getLength() 5 >>> Once you get to the depth you want you can use getNextSibling() to give you the next element at the same node level. Hope this helps. Mick -----Original Message----- From: Richard Clark To: jyt...@li... Sent: 8/9/01 12:18 PM Subject: [Jython-users] problem with Xerces equals I'm using the Xerces DOM parser. I'm trying to execute some code that only gets the first level of children from a tree: parent | +---->child1 | | | +----->child3 | +---->child2 I only want to get child1 and child2. so what I do is: for node in parent.childNodes: if node.parentNode == parent: #do stuff in jython the '==' comparison always fails. Under Python the same code works alright. Any ideas? Thanks, Rich _______________________________________________ Jython-users mailing list Jyt...@li... http://lists.sourceforge.net/lists/listinfo/jython-users |
From: Robert W. B. <rb...@di...> - 2001-08-09 19:26:19
|
Hello Siva, On Thu, 9 Aug 2001, Siva Subramanian Somu wrote: > Hi, > I know a zillion questions would have been asked about embedding jython in > java, > but I need to know how to do this. The problem is as follows > > I have a java application which will create some number of jython > interpreters and each one > of the created interpreters will be executing a same script over and over > again. So I don't > want the interpreter to waste time parsing the script again and again. So I > want to know > is there someway for me to avoid parsing. Is there someway I could save the > parsed code > in binary form in memory and get Jython to use that? Any help regarding this > question > would be greatly appreciated. > > thanks, > Siva Option 1- write it so that you can run the script once and only apply a callable object each subsequent need. Here's Pseudo-code: interp.execfile("myscriptfile"); for (int i=0; i < 1000; i++) { interp.exec("function_in_myscriptfile()"); } This execs the file once, and subsequently only invokes a callable object defined in the script. Care with module global vars is required. Option 2- compile the script once and use the compiled bytecode for each subsequent interp.exec(). To do this, use the built-in compile function shown in the following pseudocode: //this would really be file contents instead of a PyString PyString mycode = new PyString("print 'Hello World'"); PyCode code = __builtin__.compile(mycode, "<>", "exec"); for (int i=0; i<1000; i++) { interp.exec(code); } Executing the code object is lower overhead than the string. Let me know if larger examples would be helpful. Cheers, Robert |
From: <bc...@wo...> - 2001-08-09 19:13:59
|
[Fred Sells] >I'm having similar problem with importing my own package. > >see thread on jythonc debug help > >no solution yet. Do you have a stacktrace? I though the problem was related the empty dir(ezjava). If it isn't related, I need more info and perhaps an example that fails. regards, finn |
From: <bc...@wo...> - 2001-08-09 19:10:36
|
[Peter Brinkmann] >I've got some jython code that works fine when run with jython but >breaks down when compiled and run with java. Here's the message I'm >seeing. > >> Java Traceback: >> [...] >> Traceback (innermost last): >> File "/home/brinkman/prog/java/train/pbjp/pbjgraph.py", line 0, in main >> File "/home/brinkman/prog/java/gumbie/MenuMaker.py", line 0, in main >> java.lang.ExceptionInInitializerError: java.lang.NullPointerException It is a bug in the os module when sys.prefix is null. As a workaround you can manually assign a dummy value to sys.prefix before importing "os". import sys sys.prefix="." import os The bug is fixed in jython-2.1a3. regards, finn |
From: <bc...@wo...> - 2001-08-09 19:02:09
|
[Peter Brinkmann] > Thanks for your quick reply! You're right, --all does solve the >problem I mentioned. I'm not totally happy with this solution, though, >because I believe that the code I posted should work without the compiler >classes and that the insistence on the presence of ProxyMaker is a bug >(feature?) of jython. Jythonc attempt to track the flow of name bindings of classes at compilation time. Usually this tracking doesn't have to perfect to be usefull in real life and so far I haven't been a need like yours. Clearly there is an limit on how effective the tracking can be. If init.py contain branching around the binding to cl, there is no way jythonc can complete the tracking and detect that init.cl is a java class. OTOH the example you showed isn't more complicated than jythonc should be able to detect that init.cl is java class. Please add bug report about it. regards, finn |
From: Siva S. S. <ss...@lu...> - 2001-08-09 17:39:37
|
Hi, I know a zillion questions would have been asked about embedding jython in java, but I need to know how to do this. The problem is as follows I have a java application which will create some number of jython interpreters and each one of the created interpreters will be executing a same script over and over again. So I don't want the interpreter to waste time parsing the script again and again. So I want to know is there someway for me to avoid parsing. Is there someway I could save the parsed code in binary form in memory and get Jython to use that? Any help regarding this question would be greatly appreciated. thanks, Siva |
From: Richard C. <RC...@in...> - 2001-08-09 16:18:38
|
I'm using the Xerces DOM parser. I'm trying to execute some code that only gets the first level of children from a tree: parent | +---->child1 | | | +----->child3 | +---->child2 I only want to get child1 and child2. so what I do is: for node in parent.childNodes: if node.parentNode == parent: #do stuff in jython the '==' comparison always fails. Under Python the same code works alright. Any ideas? Thanks, Rich |
From: Peter B. <bri...@ma...> - 2001-08-09 06:01:42
|
Hello Robert, Thanks for your quick reply! You're right, --all does solve the problem I mentioned. I'm not totally happy with this solution, though, because I believe that the code I posted should work without the compiler classes and that the insistence on the presence of ProxyMaker is a bug (feature?) of jython. In particular, when compiled with --all, the resulting jar file can't be used for applets under netscape or mozilla because of security issues. Thanks again, Peter > I've got another problem with some code that works fine when interpreted > with jython but breaks down when compiled with jythonc. > > I've narrowed the problem down to the following situation. We need two > modules, say init.py and main.py. > > ---------------------------------------------------------------------- > init.py: > > import java > > cl=java.lang.Object > > ---------------------------------------------------------------------- > main.py > > import init > > class eggs(init.cl): > pass > > print eggs() > > ---------------------------------------------------------------------- > > The idea is to derive a class from another class that's determined in > a different module. [...] > |
From: Robert W. B. <rb...@di...> - 2001-08-09 04:04:42
|
Hello Peter, On Wed, 8 Aug 2001, Peter Brinkmann wrote: > Hi! > I've got another problem with some code that works fine when interpreted > with jython but breaks down when compiled with jythonc. <snip> > > However, when I compile it with > > jythonc --core --jar test.jar main.py <snip> > > java.lang.NoClassDefFoundError: java.lang.NoClassDefFoundError: org/python/compiler/ProxyMaker Use --all to get the compiler and parser packages. --core is everything but these two. try: jythonc --all --jar test.jar main.py |
From: Robert W. B. <rb...@di...> - 2001-08-09 03:59:10
|
Hi Brian, On Wed, 8 Aug 2001, Brian Parker wrote: > I'm compiling to class files like this: > jythonc --core --deep --jar my.jar *.py > > If I look in the jar, sure enough, the whole compiler "package" is not > there? Any idea what I might be doing wrong? (The code runs fine > through "jython".) you need --all to get the compiler and parser. Try: jythonc --all --jar my.jar *.py (--all implies --deep). -Robert |
From: chuck c. <cc...@zi...> - 2001-08-09 00:22:35
|
I checked out the FAQ and the Jython vs. CPython docs and wasn't able to find an answer to the following. I have this code: def test(): print noname try: print "line 5" print "line 6" test() print "line 8" print "line 9" except ValueError: print "shouldn't happen." When I run it under python I get the following stack trace: line 5 line 6 Traceback (innermost last): File "test.py", line 7, in ? test() File "test.py", line 2, in test print noname NameError: noname Under Jython I get: line 5 line 6 Traceback (innermost last): File "test.py", line 10, in ? File "test.py", line 2, in test NameError: noname I lose some granularity in Jython. If I were to call the extracted method (test in this case) several times within the try block I can't tell on which line the failing call resulted from. It always reports from the except line. Why is this? Is it the expected behavior? cheers chuck |
From: Brian P. <bp...@wi...> - 2001-08-08 23:17:58
|
I'm compiling to class files like this: jythonc --core --deep --jar my.jar *.py If I look in the jar, sure enough, the whole compiler "package" is not there? Any idea what I might be doing wrong? (The code runs fine through "jython".) Java Traceback: at org.python.core.Py.JavaError(Py.java) at org.python.core.PyTableCode.call(PyTableCode.java) at org.python.core.PyCode.call(PyCode.java) at org.python.core.imp.createFromCode(imp.java) at org.python.core.Py.runMain(Py.java) at gco.main(gco.java:673) Traceback (innermost last): File "C:\snapshots\btp_tools_rmdev\tools\iSource\src\gco.py", line 0, in main java.lang.NoClassDefFoundError: org/python/compiler/JavaMaker at org.python.core.MakeProxies.makeProxy(MakeProxies.java) at org.python.core.PyClass.init(PyClass.java) at org.python.core.PyClass.<init>(PyClass.java) at org.python.core.Py.makeClass(Py.java) at org.python.core.Py.makeClass(Py.java) at gco$_PyInner.main$8(gco.java:555) at gco$_PyInner.call_function(gco.java:236) at org.python.core.PyTableCode.call(PyTableCode.java) at org.python.core.PyCode.call(PyCode.java) at org.python.core.imp.createFromCode(imp.java) at org.python.core.Py.runMain(Py.java) at gco.main(gco.java:673) java.lang.NoClassDefFoundError: java.lang.NoClassDefFoundError: org/python/compiler/JavaMaker Thanks! |
From: Peter B. <bri...@ma...> - 2001-08-08 22:38:15
|
Hi! I've got another problem with some code that works fine when interpreted with jython but breaks down when compiled with jythonc. I've narrowed the problem down to the following situation. We need two modules, say init.py and main.py. ---------------------------------------------------------------------- init.py: import java cl=java.lang.Object ---------------------------------------------------------------------- main.py import init class eggs(init.cl): pass print eggs() ---------------------------------------------------------------------- The idea is to derive a class from another class that's determined in a different module. The jython run gives the desired result: [brinkman@c1176023-a test]$ jython main.py <__main__.eggs instance at -1244487580> However, when I compile it with jythonc --core --jar test.jar main.py and run it with java -jar test.jar I get the following stack trace: > Java Traceback: > > at org.python.core.Py.JavaError(Py.java, Compiled Code) > at org.python.core.PyTableCode.call(PyTableCode.java, Compiled Code) > at org.python.core.imp.createFromCode(imp.java, Compiled Code) > at org.python.core.Py.runMain(Py.java, Compiled Code) > at main.main(main.java, Compiled Code) > Traceback (innermost last): > File "/home/brinkman/prog/java/gumbie/test/main.py", line 0, in main > java.lang.NoClassDefFoundError: org/python/compiler/ProxyMaker > at org.python.core.PyClass.init(PyClass.java, Compiled Code) > at org.python.core.Py.makeClass(Py.java, Compiled Code) > at org.python.core.Py.makeClass(Py.java, Compiled Code) > at main$_PyInner.main$2(main.java, Compiled Code) > at main$_PyInner.call_function(main.java, Compiled Code) > at org.python.core.PyTableCode.call(PyTableCode.java, Compiled Code) > at org.python.core.imp.createFromCode(imp.java, Compiled Code) > at org.python.core.Py.runMain(Py.java, Compiled Code) > at main.main(main.java, Compiled Code) > > java.lang.NoClassDefFoundError: java.lang.NoClassDefFoundError: org/python/compiler/ProxyMaker > It appears that the problem only occurs when init.cl is a java class, such as java.lang.Object or java.awt.Frame or so. Python classes seem to work fine, both interpreted and compiled. I would appreciate any ideas regarding this problem. Thanks, Peter |