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: dman <ds...@ri...> - 2001-11-06 23:45:33
|
In both Jython and CPython (2.1),
os.makedirs( "~/tmp/not/./new" )
fails, however
os.makedirs( "~/tmp/not//new" )
succeeds.
The GNU 'mkdir' program works with either path (if --parents argument
is given, or all but last directory exist).
Should os.makedirs() call os.normalize() first, or is this supposed to
be a client responsibility?
-D
|
|
From: dman <ds...@ri...> - 2001-11-06 21:32:43
|
On Tue, Nov 06, 2001 at 02:35:21PM -0500, Robert Mueller wrote:
| Hi,
|
| I need some information using the Jython docstring feature. Could you
| please advise.
Simply put a string after a "def" or "class" line. Example :
def my_func( ) :
"""
This is the doc string.
"""
print "Hello World"
This is similar to "javadoc" comments, if you are familiar with them.
HTH,
-D
|
|
From: Robert M. <rob...@ul...> - 2001-11-06 19:36:52
|
Hi, I need some information using the Jython docstring feature. Could you please advise. Thankx, Rob - new user |
|
From: <bc...@wo...> - 2001-11-06 16:43:57
|
[From a bug report] >http://sourceforge.net/tracker/?func=detail&atid=112867&aid=451552&group_id=12867 > >Summary: case insensitivity on import causes prob > >Initial Comment: >I am using a package which contains a class named "visad.Data" and >one named "visad.data.mcidas.PointDataAdapter". When I try to do: > >from visad.data.mcidas import PointDataAdapter > >an exception is thrown (see stack trace, below). However if I >do this sequence: > >from visad import * >from visad.data.mcidas import PointDataAdapter > >then the PointDataAdapter is imported without difficulty. > >Here is the stack trace: >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) I guess this bug only occur on Windows like filesystems. It happen because we do a check for the name "visad.data" as a java class before looking the "visad.data" java package in the package manager. I have two solutions. 1) Catch the NoClassDefFoundError and interpret that event as if the class does not exists. Previous versions of jython did that and the result was confusing error messages when NoClassDefFoundError was thrown for other reasons. 2) Reverse the lookup rules so that we check for a "visad.data" java package before checking for a "visad.data" class. In the packagemanager we can then verify that the "visad/data" directory have the correct case spelling. I prefer #2. I don't think it will cause problems to switch the lookup order because the JLS does not allow a class and a package with the same name: http://java.sun.com/docs/books/jls/second_edition/html/names.doc.html#34993 A patch that implement #2 is here: >http://sourceforge.net/tracker/index.php?func=detail&aid=478763&group_id=12867&atid=312867 regards, finn |
|
From: <no...@so...> - 2001-11-06 16:39:43
|
Patches item #478763, was opened at 2001-11-06 08:39 You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=312867&aid=478763&group_id=12867 Category: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: Finn Bock (bckfnn) Assigned to: Samuele Pedroni (pedronis) Summary: import case sensitivity Initial Comment: A patch for bug #451552. It reverse the lookup order so that java packages is checked before java classes. The patch also verifies that the case of a directory is correct. ---------------------------------------------------------------------- You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=312867&aid=478763&group_id=12867 |
|
From: <bc...@wo...> - 2001-11-06 10:09:30
|
[Kevin Butler]
>> It must also be posible to
>> override the os.name property in the registry file; something like
>>
>> python.os=Windows
>
>How about 'nt|dos|mac|unix'?
Very good.
>>Then we need to decide how to enable this. A registry entry like
>>
>> python.environment=Shell
>
>Sounds good - I'm not sure where that would hook in?
Untested, but something like:
_envType = sys.registry.getProperty("python.environment", "Shell")
if _envType == "Shell":
_shellEnv = _getShellEnv()
# support environ, putenv, getenv
environ = _shellEnv.environment
putenv = environ.__setitem__
getenv = environ.__getitem__
elif _envType == "None":
...
>>should be the default and other values could be "None" which is what we
>have
>>today and maybe "Properties" which could fill the environment with just
>$HOME
>>and $USER and $PATH.
>
>I didn't do anything along this line.
That's fine, for now we just need a logical place to put it, if someone
wants to add it later.
>New code attached.
>
>Note that we can call this whatever would be appropriate for integration
>into jython (shellos?) - I'm not attached to 'environ.py' by any means.
>:-)
A copy & paste into javaos.py.
># Does not:
># - read both stderror & stdin, probably in separate threads
An absolute requirement for the system() call.
># - pass changed environment to child processes started with Runtime.exec (impossible?)
An old and out of date comment?
> p = Runtime.getRuntime().exec( shellCmd, env, self._cwd )
The 3 argument version of exec() is a jdk1.3 feature. It is ok to try
and use such advanced features but there must a fallback to jdk1.1
behaviour.
I wonder if the chdir support is worth it at all. It is fine that
subshells inherit the parents (faked) notion of the $CWD but it is
confusing that files open from jython (both java and python files) does
not honor the $CWD.
>def _getOsType( os=None ):
> os = os or registry.getProperty( "python.os" ) or registry.getProperty( "os.name" )
It is better to get the os.name from the System.getProperty() method. It
is common to initialize the registry with the System.getProperties() but
it is not certain that the application embedding jython does so.
regards,
finn
|
|
From: Kevin B. <kev...@bi...> - 2001-11-06 08:41:27
|
OK, I'm getting back to environ now, integrating the feedback I received, and testing on my Linux box. From Chuck Clark: > __shellExec should be _shellExec *ouch* Sorry about that! That's what I get for making a change, then running the tests w/o restarting the VM... > 'sh -c "%s"' should be 'sh -c %s' The "%s" worked for me under cygwin, honest! The no-quotes acted like it worked, but really ignored all the arguments to the command (ls -l == ls, etc.). Workaround is to use the exec( String[] ) form (can't use Python's % operator *sigh*) > Phil Surette wrote: > The os checks were limited to Windows NT, so I went over > to http://www.tolstoy.com/samizdat/sysprops.html > and got a list of the os.name strings there and > added them in along with some guesses. Cool - thanks! Looks like WinCE uses 'cmd' (google shows lotsa hits for WinCE and cmd.exe together), so I'm classifying it as 'nt'. >Under win32, os.environ should be case-insensitive, > so I added that in as well (this follows > cpython's behaviour). Case-sensitivity should be > maintained for everything else (but this is untested). Darn it, that ruins all hope of "unwrapping" the environment dictionary, doesn't it? *sigh* Guess we could... Nope, too ugly. Functionality & clarity trump optimization. Who ever said environment variables would be fast? :-) :-( Finn Bock wrote: > A gracefull "do nothing" is needed for clasic macs. Done. > It must also be posible to > override the os.name property in the registry file; something like > > python.os=Windows How about 'nt|dos|mac|unix'? >Then we need to decide how to enable this. A registry entry like > > python.environment=Shell Sounds good - I'm not sure where that would hook in? >should be the default and other values could be "None" which is what we have >today and maybe "Properties" which could fill the environment with just $HOME >and $USER and $PATH. I didn't do anything along this line. New code attached. Note that we can call this whatever would be appropriate for integration into jython (shellos?) - I'm not attached to 'environ.py' by any means. :-) Thanks kb |
|
From: Stephen L A. <sa...@ea...> - 2001-11-05 05:35:54
|
Howdy: Here are some new links for the new Linux-Java based PDA from Sharp. It needs jython. The developer version is supposedly available Nov 5. Description: http://www.linuxdevices.com/articles/AT2134869242.html Availability announcement - 10/18/2001 http://www.linuxdevices.com/news/NS7756702433.html Developer info: http://developer.sharpsec.com/ |
|
From: Phil S. <phi...@ho...> - 2001-11-05 04:22:55
|
Thanks Finn, I will try this stuff out sometime this week.
Jython _is_ more magical than I thought!
Finn Bock wrote:
>
> >> >
> >> >I'm writing three tasks:
> >> >1) a jython task. This is like the ant <script> task
> >> >but it has several improvements:
> >> > - handles indented jython scripts.
> >> > - massages stack traces to make line numbers relative to
> >> >the ant build file, rather than relative to the start of the
> >> >script within the build file
> >
> >By the way, I gave up on figuring out how PyTracebacks work
> >(too many PyObjects)
>
> The trick is never to trust what you see when calling
> System.out.print(). Some of the classes in the exception & traceback
> subsystem override toString().
>
> >and ended up doing a regex thing to
> >patch up the line numbers. Am I missing some critical
> >piece of information?
>
> It turned out that jython is badly prepared for setting the start line
> numbers in a call to compile(). I have added for feature request about
> it, but until it is implementated you might be able to use the hack
> below.
>
> >> jytaskdef would then call project.addTaskDefinition("MyTask", MyTask).
> >>
> >> So, how big is my misunderstanding?
> >
> >Well, I didn't think that you could call jython classes
> >directly from java...
>
> A python class which extends a java class or java interface is a
> completely ordinary java class.
>
> >ant needs to be able to load the class in a classloader
>
> If the new task is added by project.addTaskDefinition(String,Class)
> there is no need to let ant do the loading of the class.
>
> You can get hold of the new Task and use like this:
>
> PyObject newClass = interp.get("MyTask");
> Object tmp = newClass.__tojava__(Class.class);
> if (tmp != Py.NoConversion && Task.class.isAssignableFrom((Class) tmp) {
> project.addTaskDefinition("MyTask", (Class)tmp);
> }
>
> >and call various setxxx methods
> >and then call execute.
> >
> >Maybe jython is even more magical than I thought?
>
> regards,
> finn
>
> public class x {
> public static void main(String[] args) {
> PythonInterpreter interp = new PythonInterpreter();
> try {
> // a syntax error
> interp.exec(
> "if 1:\n" +
> " a = 1\n" +
> " b = 0\n");
> } catch (PyException exc) {
> fixAndPrintError(exc, 20);
> }
>
> try {
> // throws a NameError
> interp.exec(
> "def foo():\n" +
> " a = c\n" +
> "foo()\n");
> } catch (PyException exc) {
> fixAndPrintError(exc, 20);
> }
> }
>
> private static void fixAndPrintError(PyException exc, int startLine) {
> System.out.println();
> System.out.println("Traceback (innermost last):");
>
> if (exc instanceof PySyntaxError) {
> PySyntaxError se = (PySyntaxError)exc;
> se.instantiate();
> int line = se.value.__getattr__("lineno").__int__().getValue();
> int col = se.value.__getattr__("offset").__int__().getValue();
> String text = se.value.__getattr__("text").toString();
> String filename = se.value.__getattr__("filename").toString();
> System.out.println(" File \""+filename+"\", line "+
> (line+startLine));
> if (text != null && text.length() != 0) {
> System.out.println("\t"+text);
> String space = "\t";
> for(int j=1; j<col; j++)
> space = space+" ";
> System.out.println(space+"^");
> }
> System.out.println("SyntaxError: " + exc.value.__getitem__(0));
> return;
> }
>
> PyTraceback tb = exc.traceback;
> StringBuffer buf = new StringBuffer();
> dumpStack(tb, buf, startLine);
> System.out.print(buf);
>
> PyObject typeName;
> if (exc.type instanceof PyClass) {
> typeName = new PyString(((PyClass)exc.type).__name__);
> } else {
> typeName = exc.type;
> }
>
> System.out.println(typeName + ": " + exc.value);
> }
>
> private static String line(PyTraceback tb, int startLine) {
> if (tb.tb_frame == null || tb.tb_frame.f_code == null)
> return " (no code object) at line "+
> (tb.tb_lineno + startLine)+"\n";
> return " File \""+tb.tb_frame.f_code.co_filename+
> "\", line "+(tb.tb_lineno + startLine)+
> ", in "+tb.tb_frame.f_code.co_name+"\n";
> }
>
> public static void dumpStack(PyTraceback tb, StringBuffer buf,
> int startLine) {
> buf.append(line(tb, startLine));
> if (tb.tb_next != Py.None && tb.tb_next != tb)
> dumpStack((PyTraceback) tb.tb_next, buf, startLine);
> else if (tb.tb_next == tb) {
> buf.append("circularity detected!"+tb+tb.tb_next);
> }
> }
>
> }
>
> _______________________________________________
> Jython-dev mailing list
> Jyt...@li...
> https://lists.sourceforge.net/lists/listinfo/jython-dev
|
|
From: Tohru K. <toh...@ya...> - 2001-11-04 21:37:42
|
Finn, That's strange. I am trying on that link as well. It still didn't work for me. When did you try it? Btw, I have no problem on other things from Source, for example, jBoss-Tomcat. -Tohru ----- Original Message ----- From: "Finn Bock" <bc...@wo...> To: <jyt...@li...> Cc: "Tohru Kao" <to...@bi...> Sent: Sunday, November 04, 2001 1:21 AM Subject: Re: [Jython-dev] Jython Download problem... > [Tohru Kao] > > >Hi, > > > >I have problem to download Jython 2.x. > > > >Does anyone have the same problem? > > I don't. I could download both 2.0 and 2.1a3 from here: > > http://sourceforge.net/project/showfiles.php?group_id=12867 > > regards, > finn _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com |
|
From: <bc...@wo...> - 2001-11-04 09:18:41
|
[Tohru Kao] >Hi, > >I have problem to download Jython 2.x. > >Does anyone have the same problem? I don't. I could download both 2.0 and 2.1a3 from here: http://sourceforge.net/project/showfiles.php?group_id=12867 regards, finn |
|
From: Tohru K. <toh...@ya...> - 2001-11-04 08:57:39
|
Oops, forgot to say "Please..." :-) ----- Original Message ----- From: "Tohru Kao" <toh...@ya...> To: <jyt...@li...> Sent: Sunday, November 04, 2001 12:53 AM Subject: Jython Download problem... > Hi, > > I have problem to download Jython 2.x. > > Does anyone have the same problem? > > Thanks, > -Tohru > _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com |
|
From: Tohru K. <toh...@ya...> - 2001-11-04 08:53:05
|
Hi, I have problem to download Jython 2.x. Does anyone have the same problem? Thanks, -Tohru _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com |
|
From: Jeremy H. <je...@zo...> - 2001-11-02 20:27:47
|
>>>>> "FB" == Finn Bock <bc...@wo...> writes: FB> [M. Ranganathan] >> Can I restrict an imbedded jython interpreter in the same fashion >> that I can restrict an imbedded python interpreter. Do I have to >> resort to the java.security properties to do this? If there is a >> better way, I would appreciate a tip on how to proceed. FB> The best way (IMO) is to use a security manager. Simply because FB> the java security manager feature have been put through more FB> testing and review than any similar feature we could add to FB> jython. One limitation of this approach is that you can't restrict access to anything written in Python. One of the chief limitations of Python for security is that you don't have any access controls on instances. A private name (__name) is just as accessible as any other name. Adding some coarse access controls if one of the features of rexec. I suppose you could write a generic wrapper object in Java and use it to wrap Python objects. Jeremy |
|
From: <bc...@wo...> - 2001-11-02 15:54:22
|
[Samuele]
>I'm a bit pedantic :)
>
>> if (exc instanceof PySyntaxError) {
>> PySyntaxError se = (PySyntaxError)exc;
>> se.instantiate();
>
>IMHO all code outside the jython codebase should
>not rely ...
Guilty as charged.
regards,
finn
|
|
From: <bc...@wo...> - 2001-11-02 15:39:25
|
[Kevin & Phil] >class ShellExec: > unixTemplate = 'sh -c "%s"' > ntTemplate = 'cmd /c %s' > dosTemplate = 'command /c %s' # from http://www.easydos.com/command.html > winceTemplate = dosTemplate # just guessing here > defaultTemplate = unixTemplate > # the keys for these templates taken from > # http://www.tolstoy.com/samizdat/sysprops.html > templates = { > "Windows 95": dosTemplate, # does this catch 98, ME? > "Windows 98": dosTemplate, # guessing > "Windows ME": dosTemplate, # guessing > "Windows NT": ntTemplate, > "Windows NT 4.0": ntTemplate, > "WindowsNT": ntTemplate, > "Windows 2000": ntTemplate, > "Windows CE": winceTemplate, # I do wince when I contemplate CE > "Windows XP": ntTemplate # guessing > } A gracefull "do nothing" is needed for clasic macs. It must also be posible to override the os.name property in the registry file; something like python.os=Windows and then there should some generic entries like "Windows": ntTemplate, "Unix": unixTemplate, "Mac": None, Then we need to decide how to enable this. A registry entry like python.environment=Shell should be the default and other values could be "None" which is what we have today and maybe "Properties" which could fill the environment with just $HOME and $USER and $PATH. regards, finn |
|
From: Samuele P. <ped...@bl...> - 2001-11-02 12:42:35
|
I'm a bit pedantic :)
>
> if (exc instanceof PySyntaxError) {
> PySyntaxError se = (PySyntaxError)exc;
> se.instantiate();
IMHO all code outside the jython codebase should
not rely on the fact that the codebase throws
SyntaxError wrapped as PySyntaxError instances and not
generic PyException instances. That's an impl.
detail and I can imagine a remote scenario where
some imports trigger an import hook which sometimes
programmatically raises a SyntaxError (which then would
not be wrapped in a PySyntaxError) ...
so the above code should be in the form:
if (Py.matchException(exc,Py.SyntaxError) {
...
regards, Samuele.
|
|
From: <bc...@wo...> - 2001-11-02 11:31:40
|
>> >
>> >I'm writing three tasks:
>> >1) a jython task. This is like the ant <script> task
>> >but it has several improvements:
>> > - handles indented jython scripts.
>> > - massages stack traces to make line numbers relative to
>> >the ant build file, rather than relative to the start of the
>> >script within the build file
>
>By the way, I gave up on figuring out how PyTracebacks work
>(too many PyObjects)
The trick is never to trust what you see when calling
System.out.print(). Some of the classes in the exception & traceback
subsystem override toString().
>and ended up doing a regex thing to
>patch up the line numbers. Am I missing some critical
>piece of information?
It turned out that jython is badly prepared for setting the start line
numbers in a call to compile(). I have added for feature request about
it, but until it is implementated you might be able to use the hack
below.
>> jytaskdef would then call project.addTaskDefinition("MyTask", MyTask).
>>
>> So, how big is my misunderstanding?
>
>Well, I didn't think that you could call jython classes
>directly from java...
A python class which extends a java class or java interface is a
completely ordinary java class.
>ant needs to be able to load the class in a classloader
If the new task is added by project.addTaskDefinition(String,Class)
there is no need to let ant do the loading of the class.
You can get hold of the new Task and use like this:
PyObject newClass = interp.get("MyTask");
Object tmp = newClass.__tojava__(Class.class);
if (tmp != Py.NoConversion && Task.class.isAssignableFrom((Class) tmp) {
project.addTaskDefinition("MyTask", (Class)tmp);
}
>and call various setxxx methods
>and then call execute.
>
>Maybe jython is even more magical than I thought?
regards,
finn
public class x {
public static void main(String[] args) {
PythonInterpreter interp = new PythonInterpreter();
try {
// a syntax error
interp.exec(
"if 1:\n" +
" a = 1\n" +
" b = 0\n");
} catch (PyException exc) {
fixAndPrintError(exc, 20);
}
try {
// throws a NameError
interp.exec(
"def foo():\n" +
" a = c\n" +
"foo()\n");
} catch (PyException exc) {
fixAndPrintError(exc, 20);
}
}
private static void fixAndPrintError(PyException exc, int startLine) {
System.out.println();
System.out.println("Traceback (innermost last):");
if (exc instanceof PySyntaxError) {
PySyntaxError se = (PySyntaxError)exc;
se.instantiate();
int line = se.value.__getattr__("lineno").__int__().getValue();
int col = se.value.__getattr__("offset").__int__().getValue();
String text = se.value.__getattr__("text").toString();
String filename = se.value.__getattr__("filename").toString();
System.out.println(" File \""+filename+"\", line "+
(line+startLine));
if (text != null && text.length() != 0) {
System.out.println("\t"+text);
String space = "\t";
for(int j=1; j<col; j++)
space = space+" ";
System.out.println(space+"^");
}
System.out.println("SyntaxError: " + exc.value.__getitem__(0));
return;
}
PyTraceback tb = exc.traceback;
StringBuffer buf = new StringBuffer();
dumpStack(tb, buf, startLine);
System.out.print(buf);
PyObject typeName;
if (exc.type instanceof PyClass) {
typeName = new PyString(((PyClass)exc.type).__name__);
} else {
typeName = exc.type;
}
System.out.println(typeName + ": " + exc.value);
}
private static String line(PyTraceback tb, int startLine) {
if (tb.tb_frame == null || tb.tb_frame.f_code == null)
return " (no code object) at line "+
(tb.tb_lineno + startLine)+"\n";
return " File \""+tb.tb_frame.f_code.co_filename+
"\", line "+(tb.tb_lineno + startLine)+
", in "+tb.tb_frame.f_code.co_name+"\n";
}
public static void dumpStack(PyTraceback tb, StringBuffer buf,
int startLine) {
buf.append(line(tb, startLine));
if (tb.tb_next != Py.None && tb.tb_next != tb)
dumpStack((PyTraceback) tb.tb_next, buf, startLine);
else if (tb.tb_next == tb) {
buf.append("circularity detected!"+tb+tb.tb_next);
}
}
}
|
|
From: <bc...@wo...> - 2001-11-02 09:16:31
|
>|
>| Either os.putenv() shouldn't be implemented at all or it should be
>| implemented as:
>|
>| def putenv(varname, value):
>| os.enviroment[varname] = value
[dman]
>This depends on what the semantics of os.environ should be. In
>CPython, the line
> os.environ[ key ] = value
>doesn't work. At least, it _may_ change theh dict, but it has no
>effect on the environment.
On my win2k box it changes the environment for subsequent os.system()
calls. That is the main thing I would expect it to do:
[d:\]\python\Python211\python.exe
Python 2.1.1 (#20, Jul 20 2001, 01:19:29) [MSC 32 bit (Intel)] on win32
Type "copyright", "credits" or "license" for more information.
>>> import os
>>> os.environ['ZZZZ'] = "new value"
>>> os.system("set")
=C:=C:\
=D:=D:\
...
windir=C:\WINNT
ZZZZ=new value
0
>>>
>| >I was thinking that, perhaps, some environment values can be gotten
>| >from Java directly. For example,
>| >
>| > print os.eviron[ "HOME" ]
>| >
>| > could be the same as
>| >
>| > System.out.println( System.getProperty( "user.home" ) ) ;
>| >
>| >though on some JVMs, user.home is really messed up (ex, jdk1.1.8 on
>| >win). I think Java ignores the user's preferences (ie setting $HOME
>| >in bash or cmd.exe) and using whatever it feels like, so this may not
>| >be a good idea.
>|
>| The property route should not be mixed with the "sh -c env" route. Using
>
>Ahh, I see, _that's_ how you get ahold of the data!
>
>| properties have been mentioned before, but nobody have picked it up and
>| suggested a patch. I guess it is because the defined set of properties
>| is too limited to be really usefull as a replacement for environment
>| variables.
>
>I am using Moshe's PMS framework with Jython right now for a school
>project. My group has not used python at all, but is familiar with
>Java hence the choice to use Jython. Anyways, in the system as it is
>shipped, there is the line
>
> DIR = os.path.join( os.environ[ "HOME" ] , "something" )
Yeah, I expect that is a common usage. Maybe we ought to have a way of
supporting it for $HOME and $USER. Maybe $CLASSPATH. Any other common
names?
regards,
finn
|
|
From: Phil S. <phi...@ho...> - 2001-11-02 07:43:28
|
Finn Bock wrote: > > [Phil Surette] > > >Yeah, I'm doing that. > > > >I'm writing three tasks: > >1) a jython task. This is like the ant <script> task > >but it has several improvements: > > - handles indented jython scripts. > > - massages stack traces to make line numbers relative to > >the ant build file, rather than relative to the start of the > >script within the build file By the way, I gave up on figuring out how PyTracebacks work (too many PyObjects) and ended up doing a regex thing to patch up the line numbers. Am I missing some critical piece of information? > > - auto-imports some packages (right now, os, os.path, > >sys, string, re) - interetes to hear if others think > >this is a good/evil feature > > This part is evil. Rule #2 clearly says that explicit is better than > implicit. > http://www.python.org/doc/Humor.html#zen > > If you really think it is usefull, I can't see any problems with adding > a xml attribute to the jython tag to enable automatic import of some > modules, say: > > <jython autoimports="true"> > os.mkdir("newdir") > </jython> > I admit that it is evil. However, it is also something that I want; otherwise my embedded scripts are often more than 50% imports. I am planning to add options for controlling it but haven't worked them out yet. Once I have maybe I'll propose a vote. > > - saves typing <jython> vs <script language="jpython"> > >The jython task is working. > > Cool. > > >2) jythonc task - haven't started yet, hopefully tonight. > > > >3) jytaskdef task - define an ant task from within an > >ant build file. You write some jython code with (at > >the minimum) an execute(self) method; this code gets > >embedded in a jython class that extends org.apache.an.main.Task; > >this gets compiled with jythonc; > > Is the jythonc step needed? Maybe I misunderstand the intention behind > jytaskdef, but from your description, I imagine something like: > > <jytaskdef taskname="MyTask"> > import org > class MyTask(org.apache.tools.ant.Task): > def execute(self): > print "Do something usefull" > </jytaskdef> > > jytaskdef would then call project.addTaskDefinition("MyTask", MyTask). > > So, how big is my misunderstanding? Well, I didn't think that you could call jython classes directly from java... ant needs to be able to load the class in a classloader and call various setxxx methods and then call execute. Maybe jython is even more magical than I thought? > > >then the task is defined > >and available everywhere in the build script. > > > >I do not expect that the ant developers will like/want to > >maintain task #3... however I think it will be very useful. > > I'm not sure I would want the jakarta people to maintain #2. We should > be able to add new options to the jythonc and ensure that ant > integration is in sync. Assuming it is technically possible to include > the task in jython.jar, I would prefer to maintain it outself. > > OTOH, I have never maintained an ant Task. If the ant project changes > the API between every ant release it may to big a job to keep up with > them. > > >Anyway, I'll submit the tasks to the jython group when > >they're ready. > > Nice. > > regards, > finn > > _______________________________________________ > Jython-dev mailing list > Jyt...@li... > https://lists.sourceforge.net/lists/listinfo/jython-dev |
|
From: chuck c. <cc...@zi...> - 2001-11-02 07:02:41
|
The good news is that with the same 'sh -c %s' all the tests passed on my Solaris box too. So I think we just need to have kevin update it and things look to work reasonably well on unix. I'll continue to play with it and report back any other findings. chuck On Fri, 02 Nov 2001 02:04:27 -0800 Phil Surette <phi...@ho...> wrote: > This reminds me of the bad 'ol days of shell scripting... > escaping special characters was always a black art. > |
|
From: Phil S. <phi...@ho...> - 2001-11-02 06:53:39
|
This reminds me of the bad 'ol days of shell scripting... escaping special characters was always a black art. chuck clark wrote: > > Hmm...Kevin actually had 'sh -c "%s"' in the original code > I switched to '%s' and everything worked. And then I tried > 'sh -c %s' and that worked. I was curious and tried > "sh -c '%s'" but that failed as well. So it definitely has something > to do with the quotes. In the bash man page I found the following: > > Shell builtin commands return a status of 0 (true) if suc > cessful, and non-zero (false) if an error occurs while > they execute. All builtins return an exit status of 2 to > indicate incorrect usage. > > So I'm guessing maybe the shell is having issues quoting? I get a > return code of 2 whether I use a builtin or call a command. > > chuck > |
|
From: chuck c. <cc...@zi...> - 2001-11-02 06:50:49
|
Hmm...Kevin actually had 'sh -c "%s"' in the original code
I switched to '%s' and everything worked. And then I tried
'sh -c %s' and that worked. I was curious and tried
"sh -c '%s'" but that failed as well. So it definitely has something
to do with the quotes. In the bash man page I found the following:
Shell builtin commands return a status of 0 (true) if suc=AD
cessful, and non-zero (false) if an error occurs while
they execute. All builtins return an exit status of 2 to
indicate incorrect usage.
So I'm guessing maybe the shell is having issues quoting? I get a
return code of 2 whether I use a builtin or call a command.
chuck
On Fri, 02 Nov 2001 01:40:26 -0800
Phil Surette <phi...@ho...> wrote:
> Looks like we are each doing some of the same work.
> Hopefully we can merge our changes - I made a number
> of them.
>=20
> I haven't got a linux box to test with tonight; can
> you try wrapping the arguments with quotes?
>=20
> i.e. instead of '/bin/sh -c %s' use '/bin/sh -c "%s"'
>=20
|
|
From: Phil S. <phi...@ho...> - 2001-11-02 06:29:44
|
Looks like we are each doing some of the same work. Hopefully we can merge our changes - I made a number of them. I haven't got a linux box to test with tonight; can you try wrapping the arguments with quotes? i.e. instead of '/bin/sh -c %s' use '/bin/sh -c "%s"' chuck clark wrote: > > Kevin... > I've got a real interest in getting your os module to work so I began tonight > trying to get it to run on my unix boxes - one solaris and one linux. I > started testing on the linux box first which is running mandrake 8.1, > jython2.1a3 and the IBM JDK 1.3. When I first ran the module there were errors > because you call a method on __shellExec when you define it as _shellExec. > Simple typo - but once fixed the tests fail for me with the message: > AssertionError: echo hello there failed with default environment > > I started looking into it a little deeper and it appears than any command with > arguments fail. If i add "ls", "date" and "uptime" to the beginning of the > testCmds list they work. However when I add in "ls -l" I get the assertion. > It appears the shell returns with an exit code of 2. sh on my machine is bash. > I tried it with csh and tcsh and the exit code is 1. This is going to be some > quirky unix shell thing it looks like. I'm experiementing now and reading man > pages. Anyone else with more unix knowledge know what might be happening here? > > chuck > > On Thu, 01 Nov 2001 23:51:32 -0800 > Phil Surette <phi...@ho...> wrote: > > > Thanks Kevin! Great stuff. > > > > I tested it out on my Win 2000 box. > > My linux box is unavailable right now, but I can test > > it on that soon if no one else does. > > > > I'm a version of the script with > > the following modifications: > > > > The os checks were limited to Windows NT, so I went over > > to http://www.tolstoy.com/samizdat/sysprops.html > > and got a list of the os.name strings there and > > added them in along with some guesses. > > > > Under the Win95 stream I believe the correct command > > is 'command /c' so I poked that in, hope someone can > > verify that this works. I'm relying on > > http://www.easydos.com/dosindex.html for this info. > > > > Under win32, os.environ should be case-insensitive, > > so I added that in as well (this follows > > cpython's behaviour). Case-sensitivity should be > > maintained for everything else (but this is untested). > > > > I didn't really take an in-depth look at the module > > other than to verify that it seems to work as > > expected. > > > > _______________________________________________ > Jython-dev mailing list > Jyt...@li... > https://lists.sourceforge.net/lists/listinfo/jython-dev |
|
From: chuck c. <cc...@zi...> - 2001-11-02 06:17:07
|
Kevin... I've got a real interest in getting your os module to work so I began tonight trying to get it to run on my unix boxes - one solaris and one linux. I started testing on the linux box first which is running mandrake 8.1, jython2.1a3 and the IBM JDK 1.3. When I first ran the module there were errors because you call a method on __shellExec when you define it as _shellExec. Simple typo - but once fixed the tests fail for me with the message: AssertionError: echo hello there failed with default environment I started looking into it a little deeper and it appears than any command with arguments fail. If i add "ls", "date" and "uptime" to the beginning of the testCmds list they work. However when I add in "ls -l" I get the assertion. It appears the shell returns with an exit code of 2. sh on my machine is bash. I tried it with csh and tcsh and the exit code is 1. This is going to be some quirky unix shell thing it looks like. I'm experiementing now and reading man pages. Anyone else with more unix knowledge know what might be happening here? chuck On Thu, 01 Nov 2001 23:51:32 -0800 Phil Surette <phi...@ho...> wrote: > Thanks Kevin! Great stuff. > > I tested it out on my Win 2000 box. > My linux box is unavailable right now, but I can test > it on that soon if no one else does. > > I'm a version of the script with > the following modifications: > > The os checks were limited to Windows NT, so I went over > to http://www.tolstoy.com/samizdat/sysprops.html > and got a list of the os.name strings there and > added them in along with some guesses. > > Under the Win95 stream I believe the correct command > is 'command /c' so I poked that in, hope someone can > verify that this works. I'm relying on > http://www.easydos.com/dosindex.html for this info. > > Under win32, os.environ should be case-insensitive, > so I added that in as well (this follows > cpython's behaviour). Case-sensitivity should be > maintained for everything else (but this is untested). > > I didn't really take an in-depth look at the module > other than to verify that it seems to work as > expected. > |