You can subscribe to this list here.
| 2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(38) |
Nov
(98) |
Dec
(58) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2001 |
Jan
(114) |
Feb
(123) |
Mar
(96) |
Apr
(66) |
May
(84) |
Jun
(72) |
Jul
(128) |
Aug
(126) |
Sep
(82) |
Oct
(80) |
Nov
(148) |
Dec
(55) |
| 2002 |
Jan
(137) |
Feb
(85) |
Mar
(118) |
Apr
(67) |
May
(71) |
Jun
(28) |
Jul
(69) |
Aug
(48) |
Sep
(83) |
Oct
(79) |
Nov
(54) |
Dec
(32) |
| 2003 |
Jan
(44) |
Feb
(47) |
Mar
(59) |
Apr
(57) |
May
(43) |
Jun
(45) |
Jul
(44) |
Aug
(39) |
Sep
(27) |
Oct
(62) |
Nov
(17) |
Dec
(23) |
| 2004 |
Jan
(41) |
Feb
(51) |
Mar
(38) |
Apr
(30) |
May
(25) |
Jun
(12) |
Jul
(11) |
Aug
(27) |
Sep
(16) |
Oct
(56) |
Nov
(23) |
Dec
(29) |
| 2005 |
Jan
(75) |
Feb
(82) |
Mar
(50) |
Apr
(77) |
May
(19) |
Jun
(104) |
Jul
(47) |
Aug
(42) |
Sep
(28) |
Oct
(143) |
Nov
(62) |
Dec
(13) |
| 2006 |
Jan
(20) |
Feb
(10) |
Mar
(59) |
Apr
(45) |
May
(25) |
Jun
(129) |
Jul
(162) |
Aug
(91) |
Sep
(15) |
Oct
(39) |
Nov
(186) |
Dec
(191) |
| 2007 |
Jan
(134) |
Feb
(140) |
Mar
(106) |
Apr
(77) |
May
(92) |
Jun
(63) |
Jul
(233) |
Aug
(102) |
Sep
(119) |
Oct
(63) |
Nov
(68) |
Dec
(32) |
| 2008 |
Jan
(69) |
Feb
(91) |
Mar
(129) |
Apr
(44) |
May
(18) |
Jun
(53) |
Jul
(50) |
Aug
(25) |
Sep
(11) |
Oct
(28) |
Nov
(67) |
Dec
(36) |
| 2009 |
Jan
(20) |
Feb
(24) |
Mar
(66) |
Apr
(53) |
May
(48) |
Jun
(48) |
Jul
(59) |
Aug
(82) |
Sep
(49) |
Oct
(30) |
Nov
(16) |
Dec
(16) |
| 2010 |
Jan
(52) |
Feb
(25) |
Mar
(36) |
Apr
(34) |
May
(14) |
Jun
(15) |
Jul
(14) |
Aug
(16) |
Sep
(23) |
Oct
(6) |
Nov
(4) |
Dec
(5) |
| 2011 |
Jan
(4) |
Feb
(22) |
Mar
(45) |
Apr
(9) |
May
(8) |
Jun
(13) |
Jul
(12) |
Aug
(4) |
Sep
(6) |
Oct
(10) |
Nov
(21) |
Dec
(5) |
| 2012 |
Jan
(6) |
Feb
(9) |
Mar
(25) |
Apr
(6) |
May
(4) |
Jun
(23) |
Jul
(6) |
Aug
(18) |
Sep
(21) |
Oct
(34) |
Nov
(19) |
Dec
(25) |
| 2013 |
Jan
(8) |
Feb
(34) |
Mar
(35) |
Apr
(4) |
May
(11) |
Jun
(4) |
Jul
(7) |
Aug
(5) |
Sep
(20) |
Oct
(12) |
Nov
(11) |
Dec
(7) |
| 2014 |
Jan
(10) |
Feb
(18) |
Mar
(50) |
Apr
(26) |
May
(53) |
Jun
(21) |
Jul
(12) |
Aug
(39) |
Sep
(43) |
Oct
(26) |
Nov
(8) |
Dec
(6) |
| 2015 |
Jan
(18) |
Feb
(32) |
Mar
(31) |
Apr
(42) |
May
(38) |
Jun
(13) |
Jul
(6) |
Aug
(11) |
Sep
(29) |
Oct
(25) |
Nov
(10) |
Dec
(11) |
| 2016 |
Jan
(24) |
Feb
(12) |
Mar
(13) |
Apr
(15) |
May
(22) |
Jun
(8) |
Jul
(12) |
Aug
(25) |
Sep
(8) |
Oct
(6) |
Nov
(13) |
Dec
(7) |
| 2017 |
Jan
(6) |
Feb
(29) |
Mar
(32) |
Apr
(8) |
May
(82) |
Jun
(42) |
Jul
(20) |
Aug
(17) |
Sep
(27) |
Oct
(14) |
Nov
(22) |
Dec
(6) |
| 2018 |
Jan
(12) |
Feb
(9) |
Mar
(22) |
Apr
(19) |
May
(14) |
Jun
(9) |
Jul
(9) |
Aug
(22) |
Sep
(22) |
Oct
(12) |
Nov
(13) |
Dec
(8) |
| 2019 |
Jan
(22) |
Feb
(3) |
Mar
(30) |
Apr
(20) |
May
(20) |
Jun
(6) |
Jul
(15) |
Aug
(25) |
Sep
(11) |
Oct
(24) |
Nov
(11) |
Dec
(6) |
| 2020 |
Jan
(9) |
Feb
(12) |
Mar
(29) |
Apr
(10) |
May
(22) |
Jun
(11) |
Jul
(15) |
Aug
(5) |
Sep
(6) |
Oct
(7) |
Nov
(7) |
Dec
(13) |
| 2021 |
Jan
(21) |
Feb
(5) |
Mar
(5) |
Apr
(6) |
May
(10) |
Jun
(7) |
Jul
(6) |
Aug
(8) |
Sep
(5) |
Oct
(9) |
Nov
(5) |
Dec
(6) |
| 2022 |
Jan
(5) |
Feb
(4) |
Mar
(8) |
Apr
(6) |
May
(5) |
Jun
(5) |
Jul
(10) |
Aug
(6) |
Sep
(7) |
Oct
(4) |
Nov
(4) |
Dec
(6) |
| 2023 |
Jan
(5) |
Feb
(5) |
Mar
(6) |
Apr
(4) |
May
(5) |
Jun
(6) |
Jul
(5) |
Aug
(5) |
Sep
(5) |
Oct
(5) |
Nov
(7) |
Dec
(8) |
| 2024 |
Jan
(3) |
Feb
(1) |
Mar
|
Apr
(2) |
May
|
Jun
(1) |
Jul
(1) |
Aug
(4) |
Sep
|
Oct
|
Nov
|
Dec
(1) |
| 2025 |
Jan
|
Feb
(2) |
Mar
|
Apr
(1) |
May
|
Jun
(1) |
Jul
|
Aug
(1) |
Sep
(1) |
Oct
|
Nov
|
Dec
|
| 2026 |
Jan
|
Feb
(1) |
Mar
(2) |
Apr
(1) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Andreas J. (EWU) <And...@am...> - 2001-04-25 00:19:01
|
Hi to ease the use of a Java library from Jython I have written conversion routines between PyDictionary and mylib.XClass. It works fine when I run this from the Jython interpreter, but when I want to test my conversion routines from Java (using JUnit) I get a NullPointerException at org.python.core.InternalTables.createInternalTables. This happens when I want to (e.g.) create a PyDictionary object. I guess I missed initializing the library somehow. Is there a system property I must set?? Using Jython-2.0. Please reply directly to me since I'm not (yet) part of the list. Thanks, Andreas |
|
From: Bobby I. <imp...@fa...> - 2001-04-20 18:01:53
|
hey, folks. on the front page, you have a link to psa (under "exits"), but that link goes to a page saying that psa no longer exists and "is replaced by the Python Software Foundation". update time. -bobby ---------- live fast, kill slow |
|
From: <bc...@wo...> - 2001-04-17 19:03:45
|
[brian zimmer] >Enclosed is a patch to make time.clock() correctly return the >elapsed time from the first call to time.clock(). The existing >implementation returns the current time. Patch applied. Thanks. regards, finn |
|
From: <bc...@wo...> - 2001-04-17 16:23:38
|
[Schmidmeier, Arno] >Hello, >I have following problem. >I have a Jython Interpreter embeded in a Java-application. Whenever I >execute > >import re > >in the embedded application, I get following error: > >Traceback (innermost last): > File "<string>", line 1, in ? > File "C:\Programme\Jython\Lib\re.py", line 28, in ? > File "C:\Programme\Jython\Lib\sre.py", line 17, in ? > File "C:\Programme\Jython\Lib\sre_compile.py", line 15, in ? >AttributeError: class 'org.python.modules._sre' has no attribute 'MAGIC' > > >When I execute it from the "commandline" >nothing happens. > >Jython 2.1a1 on java1.3.0_01 (JIT: null) >Type "copyright", "credits" or "license" for more information. >>>> import re >>>> > >I do not call PySystemState.initialize nor di I call ><>Interpreter.initialise. However >python.home and install.root are defined in the Java.lang.System.Properties? > >Any comments? It sounds like a version mismatch. In the released Jython-2.0 neither the "sre_compile" nor the "_sre" module contained a MAGIC field. In the 2.1 series a MAGIC field was added to both modules. I guess your embedded use of jython picks up a different and more recent version of the standard library. It can be a library from either Jython 2.1a1 or CPython 2.1. regards, finn |
|
From: Thomas B. B. <tb...@sy...> - 2001-04-17 07:47:10
|
Hi Michael (and others).
Still hunting that EJB access from Jython within Borland AppServer 4.5...
> Did you try to run the code I posted with Borland's Initial Context
requirements and Provider_Url?
Yes, I tried to use your previous script as posted, but I get only as far as
to what value to use for the PROVIDER_URL setting. Below is "my" script, and
the exception I get ("unknown protocol "t3"", if I drop the "t3" part, I get
the same exception, simply "unknown protocol "localhost"").
> Are you able to access your beans via a java client?
Yes, I can access my beans via a J2EE client. Thus, the usual JNDI lookup
via InitialContext and so forth is working fine.
Hopes this helps anyone out there. I've looked hard in the Borland AppServer
doc for this, but have come up short so far.
Cheers,
Thomas
--- code & exception ---
import java
from java.lang import Object,StringBuffer,String
from javax.naming import *
from java.util import *
from javax.rmi import *
from java.io import *
from java.lang import System
class Client:
def __init__(self):
self.doNothing = 0
self.p = Properties()
self.jndiContext = InitialContext()
self.ref = Object()
self.p.put(Context.INITIAL_CONTEXT_FACTORY,
'com.sun.jndi.cosnaming.CNCtxFactory')
self.p.put(Context.PROVIDER_URL, 't3://localhost:14050')
def
getInitialContext(self):self.p.put(Context.INITIAL_CONTEXT_FACTORY,
'com.sun.jndi.cosnaming.CNCtxFactory')
self.p.put(Context.PROVIDER_URL, 't3://localhost:14050')
return InitialContext(self.p)
def getRemote(self,jndiContext):
self.jndiContext = self.getInitialContext()
# self.ref = jndiContext.lookup("ejb/SimpleBean")
# home = PortableRemoteObject.narrow(self.ref,SimpleBeanHome.class)
#Create a remote reference to the stateless bean
home = jndiContext.lookup("ejb/SimpleBeanHome")
sb = home.create()
print 'CONNECTION SUCCESS!!'
return sb
if __name__ == '__main__':
print 'Begin client'
a = Client()
print 'Object creation'
ctx = a.getInitialContext()
#print 'InitialContext is', ctx
#rem = a.getRemote(ctx)
#print rem.getS()
print 'End of client'
...and here's my exception:
>>> execfile("src/ejbacc.py")
Begin client
Object creation
Traceback (innermost last):
File "<console>", line 1, in ?
File "src/ejbacc.py", line 36, in ?
File "src/ejbacc.py", line 20, in getInitialContext
javax.naming.ConfigurationException: Invalid URL: t3://localhost:14050.
Root exception is java.net. MalformedURLException: unknown protocol: t3
at java.net.URL.<init>(Unknown Source)
at java.net.URL.<init>(Unknown Source)
at java.net.URL.<init>(Unknown Source)
at com.sun.jndi.cosnaming.CNCtx.getStringifiedIor(Unknown Source)
at com.sun.jndi.cosnaming.CNCtx.initOrbAndRootContext(Unknown
Source)
at com.sun.jndi.cosnaming.CNCtx.<init>(Unknown Source)
at com.sun.jndi.cosnaming.CNCtxFactory.getInitialContext(Unknown
Source)
at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.init(Unknown Source)
at javax.naming.InitialContext.<init>(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Native Method)
at
org.python.core.PyReflectedConstructor.__call__(PyReflectedConstructor.java:
125)
at org.python.core.PyJavaInstance.__init__(PyJavaInstance.java:61)
at org.python.core.PyJavaClass.__call__(PyJavaClass.java:786)
at org.python.core.PyObject.__call__(PyObject.java:272)
at org.python.pycode._pyx12.getInitialContext$3(src/ejbacc.py)
at org.python.pycode._pyx12.call_function(src/ejbacc.py)
at org.python.core.PyTableCode.call(PyTableCode.java:155)
at org.python.core.PyTableCode.call(PyTableCode.java:210)
at org.python.core.PyFunction.__call__(PyFunction.java:96)
at org.python.core.PyInstance.invoke(PyInstance.java:248)
at org.python.pycode._pyx12.f$0(src/ejbacc.py)
at org.python.pycode._pyx12.call_function(src/ejbacc.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:295)
at java.lang.reflect.Method.invoke(Native Method)
at
org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:158)
at
org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:166)
at org.python.core.PyObject.__call__(PyObject.java:272)
at org.python.pycode._pyx11.f$0(<console>)
at org.python.pycode._pyx11.call_function(<console>)
at org.python.core.PyTableCode.call(PyTableCode.java:155)
at org.python.core.Py.runCode(Py.java:1055)
at org.python.core.Py.exec(Py.java:1076)
at
org.python.util.PythonInterpreter.exec(PythonInterpreter.java:145)
at
org.python.util.InteractiveInterpreter.runcode(InteractiveInterpreter.java:8
7)
at
org.python.util.InteractiveInterpreter.runsource(InteractiveInterpreter.java
:68)
at
org.python.util.InteractiveInterpreter.runsource(InteractiveInterpreter.java
:42)
at
org.python.util.InteractiveConsole.push(InteractiveConsole.java:83)
at
org.python.util.InteractiveConsole.interact(InteractiveConsole.java:62)
at org.python.util.jython.main(jython.java:178)
javax.naming.ConfigurationException: javax.naming.ConfigurationException:
Invalid URL: t3://localhost:14050 [Root exception is
java.net.MalformedURLException: unknown protocol: t3]
Regards,
Thomas
-----Original Message-----
From: Garcia, Michael [mailto:mg...@Bu...]
Sent: 11. april 2001 19:19
Hi Thomas,
Did you try to run the code I posted with Borland's Initial Context
requirements and Provider_Url? The app server's docs should have what these
values should be. You need these values or else you cannot do a remote
lookup on your EJB's. Are you able to access your beans via a java client?
If yes, you should have no problem accessing via a Jython client.
-----Original Message-----
From: Thomas Bang Biilmann
To: Jython Dev (E-mail)
Sent: 4/11/01 3:13 AM
Subject: RE: [Jython-dev] RE: EJB access from Jython
OK, I'm just about to surrender now...
<...>
|
|
From: Schmidmeier, A. <Arn...@si...> - 2001-04-16 20:45:09
|
Hello, I have following problem. I have a Jython Interpreter embeded in a Java-application. Whenever I execute import re in the embedded application, I get following error: Traceback (innermost last): File "<string>", line 1, in ? File "C:\Programme\Jython\Lib\re.py", line 28, in ? File "C:\Programme\Jython\Lib\sre.py", line 17, in ? File "C:\Programme\Jython\Lib\sre_compile.py", line 15, in ? AttributeError: class 'org.python.modules._sre' has no attribute 'MAGIC' When I execute it from the "commandline" nothing happens. Jython 2.1a1 on java1.3.0_01 (JIT: null) Type "copyright", "credits" or "license" for more information. >>> import re >>> I do not call PySystemState.initialize nor di I call <>Interpreter.initialise. However python.home and install.root are defined in the Java.lang.System.Properties? Any comments? Arno |
|
From: brian z. <bz...@zi...> - 2001-04-16 15:47:35
|
Enclosed is a patch to make time.clock() correctly return the elapsed time from the first call to time.clock(). The existing implementation returns the current time.
brian
Index: org/python/modules/time.java
===================================================================
RCS file: /cvsroot/jython/jython/org/python/modules/time.java,v
retrieving revision 2.13
diff -u -r2.13 time.java
--- org/python/modules/time.java 2001/03/04 17:39:38 2.13
+++ org/python/modules/time.java 2001/04/16 15:41:35
@@ -38,6 +38,8 @@
switch (index) {
case 0:
return Py.newFloat(time.time$());
+ case 1:
+ return Py.newFloat(time.clock$());
default:
throw argCountError(0);
}
@@ -95,7 +97,7 @@
public static void classDictInit(PyObject dict) {
dict.__setitem__("time", new TimeFunctions("time", 0, 0));
- dict.__setitem__("clock", new TimeFunctions("clock", 0, 0));
+ dict.__setitem__("clock", new TimeFunctions("clock", 1, 0));
// calculate the static variables tzname, timezone, altzone, daylight
TimeZone tz = TimeZone.getDefault();
@@ -142,9 +144,14 @@
return System.currentTimeMillis()/1000.0;
}
- /*public static double clock() {
- return System.currentTimeMillis()/1000.0;
- }*/
+ private static double __initialclock__ = 0.0;
+ public static double clock$() {
+ if(__initialclock__ == 0.0) {
+ // set on the first call
+ __initialclock__ = time$();
+ }
+ return time$() - __initialclock__;
+ }
private static void throwValueError(String msg) {
throw new PyException(Py.ValueError, new PyString(msg));
|
|
From: Samuele P. <pe...@in...> - 2001-04-13 19:24:58
|
Hi. (I'm not vanished) [Finn] > [Danney Jarman] > > >Previously I had sent the following; however, since I did not get any > >response, here it is again. > > The first time there wasn't any code included. > > >I have been programming in Java only a few days, and one of my first > >projects was to work on the ability to integrate Jython into > >InstallShield. > >Though there were many possible solutions, I wanted to have > >the ability for Jython to import .py modules from jar and zip > >files. > > We all agree that this feature is very usefull. > > >I wrote the method loadFromZipFile into the imp.java file > >to resolve the problem. I realize it is quite crude; however, My hope is > >that a REAL Java programmer will run with it to add this capability > >to a build. I have found this capability a great deal of help in my > >attempts to create a number of Jython deployment solutions. > > There are some problems with your code. > > 1) The .zip file(s) is opened and closed for each module that is > searched through sys.path. That will make .py and $py.class from .zip > very much slower than from directories. I believe that java programmers > will expect .zip files to be just as fast as directories. They will have > this expectation based on their experience with CLASSPATH envvar. That > will mean that the .zip files have to be kept open and that we must > track changes to sys.path and close the zip file only when it is removed > from sys.path. > (I was thinking about this in order to start to code something after finishing the nested scopes stuff) The problem is more serious, because one can put a jar in sys.path, import a python package then remove the jar but in theory one should be able to futher import modules from the package, tracking sys.path is not enough ... any ideas? In principle if a package gets mported from a jar we should not close the jar directly but rely on gc, or use finalization ... Old question: better to use a wrapped list for sys.path (=> some oddities) or enable to put observers on every list (overkill?) ? PS: unrelated, for the curious: jrgp.sourceforge.net |
|
From: <bc...@wo...> - 2001-04-13 17:11:33
|
[Andy Bulka]
> Love jython,
Me too.
> Cannot get shelves to work since (as the readme says) bsddb is not
>implemented. This is a pretty important piece of python that is missing -
>is there a reason for this?
bsddb require native code.
Sleepy cat (the maintainer of bsddb) have released a java binding for
their library. Using this binding (tested with version 2.7.3) you can
use the dbhash.py module below to get a bsddb module for jython. You
are on your own with getting bsddb compiled (both C and java) and
installed.
>Any chance of getting shelve working in the next release?
Shelve based on dumbdbm will work in the next release.
regards,
finn
#
# Copyright 1999 Finn Bock.
# Permission to use, copy and distribute this software is hereby granted,
# provided that the above copyright notice appear in all copies and that
# both that copyright notice and this permission notice appear.
#
# No Warranty
# The software is provided "as is" without warranty of any kind.
#
# If you have questions regarding this software, contact:
# Finn Bock, bc...@wo...
#
# This program contains material copyrighted by:
# Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
# The Netherlands.
#
# Note:
# The libdb.jar must be on your CLASSPATH.
# the libdb.dll and libdb_java.dll must be on your PATH.
#
# @version $Id: bsddb.py,v 1.8 1999/04/17 05:45:00 fb Exp $
#
import sys; sys.add_package("com.sleepycat.db")
from com.sleepycat import db
from java import lang
from jarray import array, zeros
error = "bsddb.error"
dbenv = db.DbEnv()
dbenv.set_error_stream(lang.System.err)
dbenv.set_errpfx("bsddb")
dbenv.set_mp_size(64*1024)
dbenv.appinit(".", None, 0)
class bsddbtype:
def __init__(self, bsddb):
self._db = bsddb
self._txn = None
self._seq = bsddb.cursor(self._txn, 0)
self._len = -1
def __len__(self):
if self._len < 0:
krec = db.Dbt()
krec.set_flags(db.Db.DB_DBT_MALLOC)
drec = db.Dbt()
drec.set_flags(db.Db.DB_DBT_MALLOC)
cnt = 0
status = self._seq.get(krec, drec, db.Db.DB_FIRST)
while status == 0:
cnt = cnt + 1
status = self._seq.get(krec, drec, db.Db.DB_NEXT)
self._len = cnt
return self._len
def __getitem__(self, key):
krec = db.Dbt(key)
krec.set_size(len(key))
drec = db.Dbt()
drec.set_flags(db.Db.DB_DBT_MALLOC)
status = self._db.get(self._txn, krec, drec, 0)
if status:
if status == db.Db.DB_NOTFOUND:
raise KeyError, key
else:
raise error, status
return drec.get_data().tostring()
def __setitem__(self, key, value):
krec = db.Dbt(key)
krec.set_size(len(key))
drec = db.Dbt(value)
drec.set_size(len(value))
status = self._db.put(self._txn, krec, drec, 0)
if status:
if status == db.Db.DB_NOTFOUND:
raise KeyError, key
else:
raise error, status
self._len = -1
def __delitem__(self, key):
#print "__delitem__", key, len(key), type(key)
krec = db.Dbt(key)
krec.set_size(len(key))
try:
self._db.del_(self._txn, krec, 0)
except db.DbException, e:
if e.get_errno() == db.Db.DB_NOTFOUND:
raise KeyError, key
else:
raise error, e.message
self._len = -1
def close(self):
self._seq.close()
self._db.close(0)
self._seq = None
self._db = None
def keys(self):
krec = db.Dbt()
krec.set_flags(db.Db.DB_DBT_MALLOC)
drec = db.Dbt()
drec.set_flags(db.Db.DB_DBT_MALLOC)
list = []
status = self._seq.get(krec, drec, db.Db.DB_FIRST)
while status == 0:
list.append(krec.get_data().tostring())
status = self._seq.get(krec, drec, db.Db.DB_NEXT)
self._len = len(list)
return list
def has_key(self, key):
krec = db.Dbt(key)
krec.set_size(len(key))
drec = db.Dbt()
drec.set_flags(db.Db.DB_DBT_MALLOC)
status = self._db.get(self._txn, krec, drec, 0)
return status == 0
def set_location(self, key):
krec = db.Dbt(key)
krec.set_size(len(key))
krec.set_flags(db.Db.DB_DBT_MALLOC)
drec = db.Dbt()
drec.set_flags(db.Db.DB_DBT_MALLOC)
status = self._seq.get(krec, drec, db.Db.DB_SET_RANGE)
if status != 0:
if status == db.Db.DB_NOTFOUND:
raise KeyError, key
else:
raise error, status
return (krec.get_data()[:krec.get_size()].tostring(), drec.get_data().tostring())
def _dbseq(self, seq_request):
#print "_dbseq", seq_request
krec = db.Dbt()
krec.set_flags(db.Db.DB_DBT_MALLOC)
drec = db.Dbt()
drec.set_flags(db.Db.DB_DBT_MALLOC)
status = self._seq.get(krec, drec, seq_request)
if status != 0:
raise KeyError
return (krec.get_data().tostring(), drec.get_data().tostring())
def next(self):
return self._dbseq(db.Db.DB_NEXT)
def previous(self):
return self._dbseq(db.Db.DB_PREV)
def first(self):
return self._dbseq(db.Db.DB_FIRST)
def last(self):
return self._dbseq(db.Db.DB_LAST)
def sync(self):
self._db.sync(0)
def __flags(flag):
flags=db.Db.DB_RDONLY
if flag:
if flag[0] == 'r':
flags = db.Db.DB_RDONLY
elif flag[0] == 'w':
flags = 0
elif flag[0] == 'c':
flags = db.Db.DB_CREATE
elif flag[0] == 'n':
flags = db.Db.DB_CREATE | db.Db.DB_TRUNCATE
else:
raise BsddbError, "Flag should begin with 'r', 'w', 'c' or 'n'"
if len(flag) > 1 and flag[1] == 'l':
if flag[0] == 'r':
flags = flags | db.Db.DB_SHLOCK
else:
flags = flags | db.Db.DB_EXLOCK
return flags
def btopen(file, flag=None, mode=0666, btflags=0,
cachesize=0, maxkeypage=0, minkeypage=0, psize=0, lorder=0):
flags=__flags(flag)
info = db.DbInfo()
info.set_flags(btflags)
info.set_pagesize(psize)
info.set_lorder(lorder)
info.set_cachesize(cachesize)
#info.set_bt_minkey(minkeypage)
# maxkeypage,bsize ignored
return bsddbtype(db.Db.open(file, db.Db.DB_BTREE, flags, mode, dbenv, info))
def hashopen(file, flag=None, mode=0666, bsize=0,
ffactor=0, nelem=0, cachesize=0, hash=0, lorder=0):
flags=__flags(flag)
info = db.DbInfo()
info.set_cachesize(cachesize)
info.set_lorder(lorder)
info.set_h_ffactor(ffactor)
info.set_h_nelem(nelem)
# hash & bsize ignored
return bsddbtype(db.Db.open(file, db.Db.DB_HASH, flags, mode, dbenv, info))
def rnopen(file, flag=None, mode=0666, rnflags=0,
cachesize=0, psize=0, lorder=0, reclen=0, bval="", bfname=None):
flags=__flags(flag)
info = db.DbInfo()
info.set_flags(rnflags)
info.set_cachesize(cachesize)
info.set_pagesize(psize)
info.set_lorder(lorder)
info.set_re_len(reclen)
if len(bval):
info.set_re_pad(bval[0])
if bfname:
info.set_re_source(bfname)
# hash & bsize ignored
return bsddbtype(db.Db.open(file, db.Db.DB_RECNO, flags, mode, dbenv, info))
if __name__ == "__main__":
tstdb = btopen("test.db", "n", 0666)
tstdb["100"] = "data100"
tstdb["101"] = "data100"
tstdb["099"] = "data100"
iterator = tstdb._db.cursor(None)
key = db.Dbt()
key.set_flags(db.Db.DB_DBT_MALLOC)
data = db.Dbt()
data.set_flags(db.Db.DB_DBT_MALLOC)
while iterator.get(key, data, db.Db.DB_NEXT) == 0:
ks = lang.String(key.get_data(), 0, key.get_size())
kd = lang.String(data.get_data(), 0, data.get_size())
print ks, ":", kd
iterator.close();
print tstdb["100"]
print tstdb["099"]
|
|
From: <bc...@wo...> - 2001-04-13 17:08:52
|
[Robert W. Bill]
>I'm not sure what implications there is in doing this - I've only had a
>second to look at it. However, here's a patch to PyDictionary.java that
>allows PyStringMap, as in:
>
>>>> d = {}
>>>> d.update(vars())
>
><disclaimer>
>This should be tested/studied before a case is made for this type of
>change.
That is always true, but generally PyDictionary and PyStringMap should
work together nicely. When they don't, it is a bug.
>This is only meant as 'just in case it is helpful' or 'maybe a
>start'.
></disclaimer>
>
>====================diff PyDictionary.java=============================
>
>--- jython/org/python/core/PyDictionary.java Sun Mar 4 12:08:59 2001
>+++ PyDictionary.java Thu Apr 12 21:11:22 2001
Patch applied. Thanks.
I try to avoid tabs in the java sources. All indents are done with four
spaces. Patches that follow that convention are easier for me to apply.
regards,
finn
|
|
From: <bc...@wo...> - 2001-04-13 17:08:17
|
[Danney Jarman] >Previously I had sent the following; however, since I did not get any >response, here it is again. The first time there wasn't any code included. >I have been programming in Java only a few days, and one of my first >projects was to work on the ability to integrate Jython into >InstallShield. >Though there were many possible solutions, I wanted to have >the ability for Jython to import .py modules from jar and zip >files. We all agree that this feature is very usefull. >I wrote the method loadFromZipFile into the imp.java file >to resolve the problem. I realize it is quite crude; however, My hope is >that a REAL Java programmer will run with it to add this capability >to a build. I have found this capability a great deal of help in my >attempts to create a number of Jython deployment solutions. There are some problems with your code. 1) The .zip file(s) is opened and closed for each module that is searched through sys.path. That will make .py and $py.class from .zip very much slower than from directories. I believe that java programmers will expect .zip files to be just as fast as directories. They will have this expectation based on their experience with CLASSPATH envvar. That will mean that the .zip files have to be kept open and that we must track changes to sys.path and close the zip file only when it is removed from sys.path. 2) When .py and $py.class can be loaded from zip files on sys.path, the same support should also exists for zip files on CLASSPATH. We have to find a solution for atleast #1 above before we can add this feature to the build. regards, finn |
|
From: <bc...@wo...> - 2001-04-13 17:06:54
|
[Robert W. Bill] >Hi all, > >I recently ran into another subtle differenct between CPython and >Jython that I was curious about. It concerns the "raise" >statement, and it's behavior when the first expression is an >instance object. > >2.1a1 documentation says, "If the first expression is an instance object, >the second expression must be None." > >In CPython example we see: > >>>> import exceptions >>>> excpt = exceptions.TypeError() >>>> raise excpt, "Something not None" >Traceback (most recent call last): > File "<stdin>", line 1, in ? >TypeError: instance exception may not have a separate value > > >Currently in Jython we see: > >>>> import exceptions >>>> excpt = exceptions.TypeError() >>>> raise excpt, "Something not None" >Traceback (innermost last): > File "<console>", line 1, in ? >: Something not None > > >I was thinking that raising the TypeError is worthwile here. What >do others think? I agree. >If this is a good idea, here's unified diff (cvs diff below- >which one is preferred anyway?) I personnaly prefer unified (-u) diffs. Context (-c) diff are also fine. A bare diff is mostly useless. Watch your mailer's linelength when including patches inside the mail. >====================================================== > >--- .\Py.java Sat Apr 7 16:17:42 2001 >+++ c:\windows\desktop\Py.java Sat Apr 7 16:10:44 2001 Applied. Thanks. regards, finn |
|
From: <bc...@wo...> - 2001-04-13 17:06:29
|
[Steven Marcus] >I have been trying to run some of the test cases in PyXML with >jython-2.1a1. First, it appears that someone on the PyXML team >is aware of and/or using jython as there is some special case >code to deal with importing. This is great news! > >1) However, the 4DOM code appears to be using sys.hexversion to >decide whether unicode is available. Should jython set this by >default? Yes. Jython will set this in the next release. >While where at it, what about sys.version_info? Yep, that will exist in the next release too. >2) For some reason the SECOND occurrence of >xml.sax.make_parser() fails. I have included sample program and >output below. Last time I looked, the PyXML package did not have a pure python solution that was ready for primetime. It may have changes since. Try to run the same program under CPython. If you manage to get PyXML running without any native libraries (like pyexpat), please let me know about your setup. regards, finn |
|
From: <bc...@wo...> - 2001-04-13 17:05:43
|
[Jim Adrig] >Besides the API docs, there is not much info on the jython site about >this kind of use of Jython. > >Would it be useful if I could try to put something together? Maybe a new >item in 'Working with Java' section ? > >For example, I have some test code that compares this: [Python vs. java API examples snipped] >Both allow Jython code such as this to execute: > > Total = 0 > for C in ChargeList: > print C.Code,C.Amount > Total += C.Amount > >The advantage to the second (Java) approach is that it is easier to make >everything dynamic (for example based on XML or Database definitions). >In effect the 'words' in your database definitions because 'part of' the >scripting language from a 'non-programming user' perspective. > >Let me know if you think this kind of approach is general enough to be >worth documenting on the site, and I can put something more detailed >together based on my current project. It is certainly worth documenting. If you can find the time to put together some examples, please send them to me. regards, finn |
|
From: <bc...@wo...> - 2001-04-13 17:05:19
|
[Juris]
>Hello,
>
>
>I was trying to freeze (actually web/servlet-ize, but that's besides the =
>point) my Jython application, and failed - I must be doing something =
>totally wrong. :-(.
>
>Here's a short failure scenario:
[fine example snipped]
>Now, "jython Main.py" works just fine ("kermits" is printed).
>Here's the output from "jythonc --deep" at compile time:
>
>Next, we go to "./jpywork" and do a "java Main" and get:
>-- start --
>Java Traceback:
>...
>Traceback (innermost last):
> File "E:\projects\jytest\2\Main.py", line 0, in main
> File "E:\projects\jytest\2\bpkg\B.py", line 0, in main
>ImportError: no module named apkg
>-- end --
>
>Taking a look at the ./jpywork directory shows that __init__-s (.java, =
>.class and $_PyInner.class) have only been compiled for bpkg, but not =
>for apkg.
>I tried passing it multiple arguments to compile, but it then compiled =
>it to a different "package level".
>=20
>Now, if we uncomment the first line in Main.py to also "from apkg.A =
>import A" it works just fine (but importing all modules from the main =
>application seems an ugly hack).
>
>
>Any comments will be very appreciated.
It's a bug. I have added a bug report so that it wont get lost.
>P.S. I hope this is on-topic for this list, since it _might_ be a =
>jythonc bug. If not - let me know and forgive me this time :-).
Its fine. There is no need to worry to much about the different lists.
regards,
finn
|
|
From: Robert W. B. <rb...@di...> - 2001-04-12 23:08:10
|
Hello again Jim,
I think I accidentally sent the patch used to restore my
PyDictionary.java file. so sorry.
====================diff PyDictionary.java=============================
--- jython/org/python/core/PyDictionary.java Sun Mar 4 12:08:59 2001
+++ PyDictionary.java Thu Apr 12 21:11:22 2001
@@ -54,6 +54,10 @@
dict.update((PyDictionary)arg);
return Py.None;
}
+ else if (arg instanceof PyStringMap) {
+ dict.update((PyStringMap)arg);
+ return Py.None;
+ }
else
throw Py.TypeError("dictionary expected, got " +
arg.safeRepr());
=======================================================================
Excuse-my-mental-SystemError-ly yours,
Robert
|
|
From: <Jam...@i2...> - 2001-04-12 22:02:02
|
Thanks very much, Robert.
Jim
"Robert W. Bill"
<rb...@di...> To: <Jam...@i2...>
Sent by: cc: <Jyt...@li...>
jyt...@li... Subject: Re: [Jython-dev] wrong type for vars()
eforge.net
04/12/01 07:43 PM
Hello Jim,
On Thu, 12 Apr 2001 Jam...@i2... wrote:
> I don't have easy access to the latest Jython release so I don't know if
> this is still a problem (maybe someone could check :-) ) but in the
> version I'm using vars() and foo.__dict__ (for a module foo) return an
> object which is not a dict and therefore cannot be used in the update
> method for dicts. This is kind of a pain when you have a local dict and
> need to update the values from a module import. The workaround is to
loop
> through all the values individually (yuk).
I'm not sure what implications there is in doing this - I've only had a
second to look at it. However, here's a patch to PyDictionary.java that
allows PyStringMap, as in:
>>> d = {}
>>> d.update(vars())
<disclaimer>
This should be tested/studied before a case is made for this type of
change. This is only meant as 'just in case it is helpful' or 'maybe a
start'.
</disclaimer>
====================diff PyDictionary.java=============================
--- PyDictionary.java Thu Apr 12 21:11:22 2001
+++ jython/org/python/core/PyDictionary.java Sun Mar 4 12:08:59
2001
@@ -54,10 +54,6 @@
dict.update((PyDictionary)arg);
return Py.None;
}
- else if (arg instanceof PyStringMap) {
- dict.update((PyStringMap)arg);
- return Py.None;
- }
else
throw Py.TypeError("dictionary expected, got " +
arg.safeRepr());
===================================================================
Cheers,
Robert
_______________________________________________
Jython-dev mailing list
Jyt...@li...
http://lists.sourceforge.net/lists/listinfo/jython-dev
|
|
From: Robert W. B. <rb...@di...> - 2001-04-12 21:47:14
|
Hello Jim,
On Thu, 12 Apr 2001 Jam...@i2... wrote:
> I don't have easy access to the latest Jython release so I don't know if
> this is still a problem (maybe someone could check :-) ) but in the
> version I'm using vars() and foo.__dict__ (for a module foo) return an
> object which is not a dict and therefore cannot be used in the update
> method for dicts. This is kind of a pain when you have a local dict and
> need to update the values from a module import. The workaround is to loop
> through all the values individually (yuk).
I'm not sure what implications there is in doing this - I've only had a
second to look at it. However, here's a patch to PyDictionary.java that
allows PyStringMap, as in:
>>> d = {}
>>> d.update(vars())
<disclaimer>
This should be tested/studied before a case is made for this type of
change. This is only meant as 'just in case it is helpful' or 'maybe a
start'.
</disclaimer>
====================diff PyDictionary.java=============================
--- PyDictionary.java Thu Apr 12 21:11:22 2001
+++ jython/org/python/core/PyDictionary.java Sun Mar 4 12:08:59 2001
@@ -54,10 +54,6 @@
dict.update((PyDictionary)arg);
return Py.None;
}
- else if (arg instanceof PyStringMap) {
- dict.update((PyStringMap)arg);
- return Py.None;
- }
else
throw Py.TypeError("dictionary expected, got " +
arg.safeRepr());
===================================================================
Cheers,
Robert
|
|
From: <Jam...@i2...> - 2001-04-12 17:59:11
|
I don't have easy access to the latest Jython release so I don't know if
this is still a problem (maybe someone could check :-) ) but in the
version I'm using vars() and foo.__dict__ (for a module foo) return an
object which is not a dict and therefore cannot be used in the update
method for dicts. This is kind of a pain when you have a local dict and
need to update the values from a module import. The workaround is to loop
through all the values individually (yuk).
C:\>python
Python 2.0b1 (#4, Sep 7 2000, 02:40:55) [MSC 32 bit (Intel)] on win32
Type "copyright", "credits" or "license" for more information.
>>> type(vars())
<type 'dictionary'>
>>> {}.update(vars())
>>>
C:\_Dev\pnp\build>jpython
JPython 1.1+09 with I2 extensions on java1.3.0 (JIT: null)
Copyright (C) 1997-1999 Corporation for National Research Initiatives
>>> type(vars())
<jclass org.python.core.PyStringMap at 2865120>
>>> {}.update(vars())
Traceback (innermost last):
File "<console>", line 1, in ?
TypeError: dictionary expected, got instance of
'org.python.core.PyStringMap'
>>>
Jim
|
|
From: Garcia, M. <mg...@Bu...> - 2001-04-11 17:26:36
|
Hi Thomas, Did you try to run the code I posted with Borland's Initial Context requirements and Provider_Url? The app server's docs should have what these values should be. You need these values or else you cannot do a remote lookup on your EJB's. Are you able to access your beans via a java client? If yes, you should have no problem accessing via a Jython client. If you send me your code and explain what you are doing and what errors you are getting I might be able to better help you troubleshoot your problem. regards, Mick -----Original Message----- From: Thomas Bang Biilmann To: Jython Dev (E-mail) Sent: 4/11/01 3:13 AM Subject: RE: [Jython-dev] RE: EJB access from Jython OK, I'm just about to surrender now... Does anyone have experience in accessing EJBs from Jython? I've tried for days now, without luck, and I guess that my choice of Borland AppServer does not make this any easier (or to be precise; M. Garcia's previous posting in this thread looks simple enough to me, but I cannot get it to work in an AppServer context. M. Garcia is using WebLogic, as I can grasp. I do not know which values to set for e.g. INITIAL_CONTEXT_FACTORY and PROVIDER_URL properties or indeed if these settings really are what is needed. My current scenario is this: I have several working J2EE clients looking up EJBs via the "usual" JNDI InitialContext and .lookup methods, but I do not know how to achieve something similar from Jython. I've also posted this as an AppServer setup issue to newsgroups.borland.ejb without any replies yet. I must be missing something (perhaps basic) understanding regarding naming services/initialContexts/the like. I would much appreciate any code snippets or setup info that can hint me as to get hold of a remote interface for any EJB deployed in a Borland AppServer. I can see a lot of perspective in getting this to work, since I then could test and "play" with my set of EJBs "interactively" from Jython. That could be VERY nice indeed...! Regards, Thomas _______________________________________________ Jython-dev mailing list Jyt...@li... http://lists.sourceforge.net/lists/listinfo/jython-dev |
|
From: Thomas B. B. <tb...@sy...> - 2001-04-11 07:53:38
|
> running anything but an if statement works just fine.. > all my python books say that is the right syntax... any ideas? Have you tried a "while <cond>:" block. I guess you will have the same problem here, and Jim Adrig's earlier comments look right to me as well. /Thomas |
|
From: Dominique B. <bro...@es...> - 2001-04-11 07:28:38
|
Thomas Bang Biilmann wrote:
>
> OK, I'm just about to surrender now...
>
> Does anyone have experience in accessing EJBs from Jython? I've tried for
> days now, without luck, and I guess that my choice of Borland AppServer does
> not make this any easier (or to be precise; M. Garcia's previous posting in
> this thread looks simple enough to me, but I cannot get it to work in an
> AppServer context. M. Garcia is using WebLogic, as I can grasp. I do not
> know which values to set for e.g. INITIAL_CONTEXT_FACTORY and PROVIDER_URL
> properties or indeed if these settings really are what is needed.
>
> My current scenario is this: I have several working J2EE clients looking up
> EJBs via the "usual" JNDI InitialContext and .lookup methods, but I do not
> know how to achieve something similar from Jython.
>
> I've also posted this as an AppServer setup issue to newsgroups.borland.ejb
> without any replies yet. I must be missing something (perhaps basic)
> understanding regarding naming services/initialContexts/the like.
>
> I would much appreciate any code snippets or setup info that can hint me as
> to get hold of a remote interface for any EJB deployed in a Borland
> AppServer. I can see a lot of perspective in getting this to work, since I
> then could test and "play" with my set of EJBs "interactively" from Jython.
> That could be VERY nice indeed...!
I do exactly that. All my regression tests are implemented in jython,
with some helpers in order to interract smoothly with jython (I do not
like to retype the same things twice... ;-)
I use jBoss 2.0, the client jar files are in my classpath and then it
gives something like that :
----------
System.setProperty('java.naming.factory.initial',
'org.jnp.interfaces.NamingContextFactory')
System.setProperty('java.naming.provider.url',
'localhost:1099')
def getManager ():
jndiContext = InitialContext();
ref = jndiContext.lookup("item/manager");
home = PortableRemoteObject.narrow (ref,
Class.forName('jope.ejb.ItemManagerHome'));
return home.create()
def getHome ():
jndiContext = InitialContext();
ref = jndiContext.lookup("item/item");
home = PortableRemoteObject.narrow (ref,
Class.forName('jope.ejb.ItemHome'));
return home
-----------
The first time I just copyied the java example code shipped with jBoss.
BTW, does someone know how to get rid of
"Class.forName('jope.ejb.ItemHome')" ?
Regards,
Dom
|
|
From: Thomas B. B. <tb...@sy...> - 2001-04-11 07:13:50
|
OK, I'm just about to surrender now... Does anyone have experience in accessing EJBs from Jython? I've tried for days now, without luck, and I guess that my choice of Borland AppServer does not make this any easier (or to be precise; M. Garcia's previous posting in this thread looks simple enough to me, but I cannot get it to work in an AppServer context. M. Garcia is using WebLogic, as I can grasp. I do not know which values to set for e.g. INITIAL_CONTEXT_FACTORY and PROVIDER_URL properties or indeed if these settings really are what is needed. My current scenario is this: I have several working J2EE clients looking up EJBs via the "usual" JNDI InitialContext and .lookup methods, but I do not know how to achieve something similar from Jython. I've also posted this as an AppServer setup issue to newsgroups.borland.ejb without any replies yet. I must be missing something (perhaps basic) understanding regarding naming services/initialContexts/the like. I would much appreciate any code snippets or setup info that can hint me as to get hold of a remote interface for any EJB deployed in a Borland AppServer. I can see a lot of perspective in getting this to work, since I then could test and "play" with my set of EJBs "interactively" from Jython. That could be VERY nice indeed...! Regards, Thomas |
|
From: Jim A. <ji...@tr...> - 2001-04-11 00:14:47
|
Jim Adrig wrote:
>
> It looks like the 'if' statement (and 'for') can't be split across
> 'exec' statments.
>
> Neither this:
>
> python.exec("if 1:");
> python.exec(" print 'true'");
>
> nor this:
>
> python.exec("for x in range(1,2):");
> python.exec(" print x");
>
> work for me. Of course this works:
>
> python.exec("for x in range(1,2): print x");
>
> or this (multiple lines in a SINGLE 'exec':
>
> String s = "if 1: \n print 'true'";
> python.exec(s);
>
By the way, this behavior makes sense since the 'exec' statement
COMPILES the string sent to it before executing it. It must be
syntactically correct..and complete. So I doubt this will be 'fixed'..if
it's even possible.
Is there a reason you're not using 'interpreter.execfile( infile )'
instead ?
--
__o
Jim Adrig _ \<,_
ji...@tr... ' `/ ' `
___________ `-' `-'
|
|
From: Jim A. <ji...@tr...> - 2001-04-11 00:10:17
|
Jayson Baird wrote:
>
> hi all,
>
> When trying to run a script inside of a java looping body, like so:
> interpreter.set("x", new PyInteger(42));
> while(infile.ready()) {
> interpreter.exec(infile.readLine());
> }
>
> I get the following error with the following python code:
> Exception in thread "main" Traceback (innermost last):
> (no code object) at line 0
> File "<string>", line 2
> SyntaxError: invalid syntax
>
> the file I'm reading from is as follows:
> if x == 42:
> x = x + 1;
>
> running anything but an if statement works just fine.. all my python
> books say that is the right syntax... any ideas?
>
> Jayson Baird
> js...@ci...
It looks like the 'if' statement (and 'for') can't be split across
'exec' statments.
Neither this:
python.exec("if 1:");
python.exec(" print 'true'");
nor this:
python.exec("for x in range(1,2):");
python.exec(" print x");
work for me. Of course this works:
python.exec("for x in range(1,2): print x");
or this (multiple lines in a SINGLE 'exec':
String s = "if 1: \n print 'true'";
python.exec(s);
--
__o
Jim Adrig _ \<,_
ji...@tr... ' `/ ' `
___________ `-' `-'
.
|