Oti | 1 Jun 23:49
Picon
Gravatar

Re: logging jython errors

To redirect both stdout and stderr, use:
 any_command > errors.txt 2>&1

best wishes,
Oti.

On 5/28/07, Utkarsh Upadhyay <musically.ut <at> gmail.com> wrote:
> Hi,
>
> There's a fairly simple way to do it, it seems:
>
> testfile.py
> ============================
> for i in range(999):
>         try:
>                 print int(str(i)+"causes an exception")
>         except ValueError, error:
>                 print 'Got an error ', error
> =============================
>
> C:\>jython testfile.py > errors.txt
>
> That saves all errors/output into the erros.txt file.
> However, this does NOT work quite right:
>
> c:\>jython -Dpython.verbose=debug testfile.py > errors.txt
>
> As it will still output the jython debug reports to the command prompt.

-------------------------------------------------------------------------
(Continue reading)

Oti | 2 Jun 00:20
Picon
Gravatar

Re: Using Jython in separate threads

Michael,

our team switched the machine a few days ago. It is now a 64-bit 'i do
not know how many core' machine (sorry I have to check that first).

The strange coincidence is: Now I get error reports nobody can explain, like:

1)
A method call (calling a method of the Java super class) succeeds on
one line of a script, and the exact same method call fails on the next
line (with an AttributeError). It is a simple one-line getter method
returning a reference to a private member.

2)
'instance' has no attribute X, on a line where X isn't involved at
all. But X is imported on top of the script.

Poeple say these scripts have been running successfully for a long
time on the old machine. These effects might have a completely
different reason, but who knows ?

I'll try to run your example on this machine, but I can't promise any
time frame.
I will post my findings here.

best wishes,
Oti.

On 5/22/07, Michael Chisholm <chisholm <at> mitre.org> wrote:
> It's been a few months; other higher-priority tasks got in the way of
(Continue reading)

olivier merlin | 4 Jun 09:08
Picon

Re: Using Jython in separate threads

Hello,

don't you fall under win32 specific OS issues ? I saw several threads
on problem with many threads on windows.
i ran last week complex scripts with 2048 threads under Linux . I have
to do some adjustments on the 32bit kernel and the JVM parameters.

regards,
Olivier

2007/6/2, Oti <ohumbel <at> gmail.com>:
> Michael,
>
> our team switched the machine a few days ago. It is now a 64-bit 'i do
> not know how many core' machine (sorry I have to check that first).
>
> The strange coincidence is: Now I get error reports nobody can explain, like:
>
> 1)
> A method call (calling a method of the Java super class) succeeds on
> one line of a script, and the exact same method call fails on the next
> line (with an AttributeError). It is a simple one-line getter method
> returning a reference to a private member.
>
> 2)
> 'instance' has no attribute X, on a line where X isn't involved at
> all. But X is imported on top of the script.
>
> Poeple say these scripts have been running successfully for a long
> time on the old machine. These effects might have a completely
(Continue reading)

Simon Galbraith | 5 Jun 21:42
Favicon

jars, jythonc, undeclared refs

FYI....  if you are trying to make a byte code JAR file with jythonc
2.2b1 and it includes modules with  import statements that the module
does not subsequently use, you will get compilation errors
saying.

For example:  In   \Lib\tokenize.py  the statement:

from __future__ import generators 

is never subsequently used (e.g.  generators is never instantiated)...
So I am not sure if this is a bug.  The jython runtime itself seems to
silently ignore such things.. is there a way to do that for jythonc ??

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
Petr Gladkikh | 6 Jun 06:25
Picon
Gravatar

Re: jars, jythonc, undeclared refs

On 6/6/07, Simon Galbraith <sgalbrai <at> cs.ucla.edu> wrote:
> FYI....  if you are trying to make a byte code JAR file with jythonc
> 2.2b1 and it includes modules with  import statements that the module
> does not subsequently use, you will get compilation errors
In  Python import statements are procedural not declarative. That is
import statement causes initialization of respective module. So
strictly speaking this is not a bug.

However optimisation that allows import features just in case would
probably be useful.

--

-- 
Petr Gladkikh

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
Michael Chisholm | 6 Jun 23:32
Picon
Favicon

Re: Using Jython in separate threads

I did search (via nabble) for (mail list) threads about (execution) 
threads, and saw other posts describing what seem to be exactly the same 
thing:

http://www.nabble.com/Multiple-PythonInterpreter-objects-tf2183896.html#a6040132
http://www.nabble.com/Jython-and-Java-multi-threading-tf1545433.html#a4198235

One of the replies mentioned using a separate PySystemState instance for 
each interpreter object, but as is also mentioned in these threads, it 
doesn't seem to help (it doesn't help us either).  And one of them 
mentions that restricting to a single thread makes the errors go away 
(as we observe as well).  They don't mention which platform they're 
using, but I don't know that it's necessarily a platform-specific 
problem, unless it's an issue with certain JVMs.  What seems certain is 
that ease of reproduction of the problem depends on your hardware, but 
that doesn't mean that the problem doesn't always exist.  It seems like 
either we're all doing something wrong on Windows and you're doing it 
correctly on Linux, or Linux is just a platform where it is hard to 
reproduce the problem.  Maybe I should try other JVMs or OSs...

Andy

olivier merlin wrote:
> Hello,
>
> don't you fall under win32 specific OS issues ? I saw several threads
> on problem with many threads on windows.
> i ran last week complex scripts with 2048 threads under Linux . I have
> to do some adjustments on the 32bit kernel and the JVM parameters.
>
(Continue reading)

Frank Wierzbicki | 7 Jun 01:37
Picon
Gravatar

Re: jars, jythonc, undeclared refs

On 6/5/07, Simon Galbraith <sgalbrai <at> cs.ucla.edu> wrote:
> FYI....  if you are trying to make a byte code JAR file with jythonc
> 2.2b1 and it includes modules with  import statements that the module
> does not subsequently use, you will get compilation errors
> saying.
>
> For example:  In   \Lib\tokenize.py  the statement:
>
> from __future__ import generators
>
> is never subsequently used (e.g.  generators is never instantiated)...
> So I am not sure if this is a bug.  The jython runtime itself seems to
> silently ignore such things.. is there a way to do that for jythonc ??
Generators do not work at all with jythonc in 2.2 (They do work with
regular Jython, but not jythonc.  There are fundamental problems with
the current implementation.  To get generators in the next Jython
release (after 2.2 is out) we will have to re-write jythonc.  For most
use cases, you can avoid the use of jythonc (for example see:
http://wiki.python.org/jython/JythonMonthly/Articles/September2006/1)

The one use case that cannot be worked around is working with a locked
down security manager (for example, in an unsigned applet.) for this
you will still need jythonc.

-Frank

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
(Continue reading)

Jorge, Tiago (ext | 11 Jun 11:56
Picon

Re: Using Jython in separate threads

Hello,

We have been observing this same error.

If you want a testbed, run a simple script like this one:

=========================

from package import TimeLogger

TimeLogger.getInstance().addLog("log something")

=========================

Use 10 threads, each with a PythonInterpreter instance, to process in
paralel 1000 runs of the above script, at a rate of 100 per second. 

In this conditions we have seen this happen ~30 times, with errors like
"Could not find the package" or "Could not resolve TimeLogger".

We are using Windows XP running in a PIV 2.8 HT with 1GB of RAM.

Best regards,

Tiago Jorge

-----Original Message-----
From: jython-users-bounces <at> lists.sourceforge.net
[mailto:jython-users-bounces <at> lists.sourceforge.net] On Behalf Of Michael
Chisholm
(Continue reading)

lcarlo | 12 Jun 05:45
Picon
Favicon

How to access a java program from python

Hello,

I need to call a java application from a python program.  I see that I  
can create a jython program which have a similar sintax of a python  
program, even it has the same file extension.  I can either compile it  
using jythonc into a .class file or run it with the jython executable  
file (jython file.py).  I need to know if there is a way to do the  
opposite, this means to just execute the Jython program using the  
python command (from the console, like: python file.py).  I tried it  
but it didn't work I get the following error:

C:\jython2.2b2>python listing7.py
Traceback (most recent call last):
   File "listing7.py", line 1, in ?
     from java.util import Random
ImportError: No module named java.util

I am trying to run a small example that imports the Random class, but  
it doesn't recognize it.  When I use the jython command there is no  
problem it executes it well.  Please let me know what I am doing wrong  
and also if there is a way to execute the jython programs using python.

Thanks,

Lorena Carlo

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
(Continue reading)

Jeff Emanuel | 12 Jun 06:02
Favicon

Re: How to access a java program from python

Change p to j

c:\jython2.2b2>jython listing7.py

lcarlo <at> cs.utah.edu wrote:
> Hello,
> 
> I need to call a java application from a python program.  I see that I  
> can create a jython program which have a similar sintax of a python  
> program, even it has the same file extension.  I can either compile it  
> using jythonc into a .class file or run it with the jython executable  
> file (jython file.py).  I need to know if there is a way to do the  
> opposite, this means to just execute the Jython program using the  
> python command (from the console, like: python file.py).  I tried it  
> but it didn't work I get the following error:
> 
> C:\jython2.2b2>python listing7.py
> Traceback (most recent call last):
>    File "listing7.py", line 1, in ?
>      from java.util import Random
> ImportError: No module named java.util
> 
> I am trying to run a small example that imports the Random class, but  
> it doesn't recognize it.  When I use the jython command there is no  
> problem it executes it well.  Please let me know what I am doing wrong  
> and also if there is a way to execute the jython programs using python.
> 
> Thanks,
> 
> Lorena Carlo
(Continue reading)


Gmane