Stefan Rindeskar | 1 Mar 14:57
Picon

Re: Why a basic jython program has large memory footprint ?

Yes the jvm server version is optimized for speed at the cost of slower startup time and higher memory usage.
Yet it agree with you that it sounds like a lot of RAM for just starting jython.

On my laptop I got almost the same setup as you except that I run 32bit client jvm.

Starting that small program that you had as an example consumes 30MB for me.
So your value of 152MB sounds like a lot.

As for configuring the JVM memory usage you use the -Xms and -Xmx parameters (which I saw in your example is already set for max 512MB in), but if you reduce this setting the only thing that will happen is that the jvm might stop due to out of memory error since you placed a ceiling on the memory usage.

Another thing you can try is to use the -client option when starting the java interpreter, today they ship both in the binary distribution so you can actually choose at startup if you want to run the client or the server jvm.

A short description of the memory configuration parameters:
http://www.caucho.com/resin-3.0/performance/jvm-tuning.xtp

Regards
Stefan


On Sun, Feb 28, 2010 at 10:50 PM, Preston L. Bannister <preston <at> bannister.us> wrote:
Might be interesting to try the same measure, but using the "client" JVM, rather than the "server" JVM.  I believe the server JVM tends to use more memory (but also tends to deliver higher performance for long-running server-type applications). If smaller size is more important than performance, the client JVM may be a better bet.




On Sun, Feb 28, 2010 at 11:11 AM, Michel CHAREST <michel.charest <at> uqtr.ca> wrote:
Hi,

- I have searched previous threads for discussions related to my problem, but and I have not found anything ...

- I have built some jython programs in the past with version 2.2 (I am a beginner with Jython), but I do not recall my program having such a large runtime memory footprint? I have worked extensively with CPython and Java for over a decade.

PROBLEM: Why does a basic a jython program consume so much runtime (resident) RAM memory ?

- I am using :
Jython 2.5.1 (Release_2_5_1:6813, Sep 26 2009, 13:47:54)
[OpenJDK 64-Bit Server VM (Sun Microsystems Inc.)] on java1.6.0
Type "help", "copyright", "credits" or "license" for more information.
>>>                                                                     
My underlying OS platform is Linux Enterprise Server 4.x.

Test program :
#! /bin/env jython
import sched, time
def test():
    print 'hello ...'
s = sched.scheduler(time.time, time.sleep)
sleep_time = 10
while 1:
    s.enter(sleep_time, 1, test, ())
    s.run()                    

When I do a top to check the memory footprint the above program is using, I get a whopping 152 Mbytes ?
  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
10260 charesmi  21   0  874m 152m 8596 S  0.0  7.6   0:06.47 /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/bin/java -Xmx512m -Xss1024k -classpath /p/jython
10257 charesmi  18   0 65884 1168  976 S  0.0  0.1   0:00.01 bash /p/jython/jython ./test_daemon.py
 9119 charesmi  15   0 12740 1116  840 R  2.4  0.1   0:23.74 top                   

One last piece of information : When I just open up a Jython interpreter, the memory footprint is 96 Mbytes. 

QUESTION : Is there a way to configure the jython or java runtime to consume less resident memory ?  Is this normal ?

Regards,
Michel

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Jython-users mailing list
Jython-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users



------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Jython-users mailing list
Jython-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users


------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Jython-users mailing list
Jython-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users
Chuck Bearden | 2 Mar 16:36
Picon

import question/problem

I set up Jython 2.5.1 in the standard, non-stand-alone way on a 64-bit
CentOS 5.4 server, with the OpenJDK 1.6.0 Java implementation.  I
can't get the 'from … import *' style of import to work correctly:

$ jython -i
expr: warning: unportable BRE: `^/': using `^' as the first character
of the basic regular expression is not portable; it is being ignored
*sys-package-mgr*: can't create package cache dir,
'/opt/jython-2.5.1/cachedir/packages'
Jython 2.5.1 (Release_2_5_1:6813, Sep 26 2009, 13:47:54)
[OpenJDK 64-Bit Server VM (Sun Microsystems Inc.)] on java1.6.0
Type "help", "copyright", "credits" or "license" for more information.
>>> from java.lang import *
>>> Class
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'Class' is not defined
>>> from java.lang import Class
>>> Class
<type 'java.lang.Class'>
>>>

I also tried installing Jython using the JDK from the Sun website as
well.  This kind of import does work on my Ubuntu 9.04 machine and on
a Windows machine to which I have access, using Jython 2.5.1. Still, I
suspect that I messed something up in the install. I can probably code
around the problem by naming each class I want to import, but now I
wonder if other things will break.

I didn't spot anything clearly corresponding to this problem in the
bug system or in the mail archives. Does this look familiar to anyone?

Info on my setup:

$ lsb_release -a
LSB Version:
:core-3.1-amd64:core-3.1-ia32:core-3.1-noarch:graphics-3.1-amd64:graphics-3.1-ia32:graphics-3.1-noarch
Distributor ID: CentOS
Description:    CentOS release 5.4 (Final)
Release:        5.4
Codename:       Final

$ java -version
java version "1.6.0"
OpenJDK  Runtime Environment (build 1.6.0-b09)
OpenJDK 64-Bit Server VM (build 1.6.0-b09, mixed mode)

Thanks for any pointers,
Chuck

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Jython-users mailing list
Jython-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users
Sherrell, Dana | 2 Mar 19:11

need clarification on java/jython integration issue please

Hi –

 

I am hoping I can get an explanation regarding an issue I have.  I have found a work around, however I do not understand why the issue is occurring and why the work around even resolves it.  Below I have a very simple interface in Java and a jython object that implements that interface.  If I try something to access the length property from Java by doing:

 

      MessageInterface message = (MessageInterface)factory.createObject();

      System.out.println("Message length:" + message.getLength());

 

I get the following error:

 

Exception in thread "main" Traceback (most recent call last):

  File "__pyclasspath__/message_interface.py", line 90, in __init__

AttributeError: read-only attr: length

 

 

If I add a setter method for length and expose that through the interface, I get a max recursion depth error.  If I change self.length to instead be self.msg_length the problem goes away.  If I put an underscore in front of length the problem goes away.  I have this same issue with self.source instead of self.msg_source.  However, I don’t have any problems with self.target and other attributes.  Why is it an issue for some attributes and not others? I would like to understand this problem so if anyone can explain what is going on to me I would really appreciate it.

 

Thank you.

 

public interface MessageInterface {

     

      public int getSource();

      public int getDestination();

      public int getLength();

      public int getVersion();

      public int getMessageID();

}

 

 

class Message(MessageInterface):

      def __init__(self):

            """ <at> sig Message()"""

           

            self.length = 0

            self.msg_version = 0

            self.msg_source = 0

            self.target = 0

            self.Message_ID = 0

 

 

 

def getLength(self):

            return self.length

     

     

      def getSource(self):

            return self.msg_source

     

      def getDestination(self):

            return self.target

     

      def getMessageID(self):

            return self.Message_ID

     

      def getVersion(self):

            return self.msg_version

 

 

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Jython-users mailing list
Jython-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users
Alex Grönholm | 2 Mar 19:31
Picon
Gravatar

Re: need clarification on java/jython integration issue please

2.3.2010 20:11, Sherrell, Dana kirjoitti:

Hi –

 

I am hoping I can get an explanation regarding an issue I have.  I have found a work around, however I do not understand why the issue is occurring and why the work around even resolves it.  Below I have a very simple interface in Java and a jython object that implements that interface.  If I try something to access the length property from Java by doing:

 

      MessageInterface message = (MessageInterface)factory.createObject();

      System.out.println("Message length:" + message.getLength());

 

I get the following error:

 

Exception in thread "main" Traceback (most recent call last):

  File "__pyclasspath__/message_interface.py", line 90, in __init__

AttributeError: read-only attr: length

Does this happen with the other attributes too?

 

 

If I add a setter method for length and expose that through the interface, I get a max recursion depth error.  If I change self.length to instead be self.msg_length the problem goes away.  If I put an underscore in front of length the problem goes away.  I have this same issue with self.source instead of self.msg_source.  However, I don’t have any problems with self.target and other attributes.  Why is it an issue for some attributes and not others? I would like to understand this problem so if anyone can explain what is going on to me I would really appreciate it.

 

Thank you.

 

public interface MessageInterface {

     

      public int getSource();

      public int getDestination();

      public int getLength();

      public int getVersion();

      public int getMessageID();

}

 

 

class Message(MessageInterface):

      def __init__(self):

            """ <at> sig Message()"""

           

            self.length = 0

            self.msg_version = 0

            self.msg_source = 0

            self.target = 0

            self.Message_ID = 0

 

 

 

def getLength(self):

            return self.length

     

     

      def getSource(self):

            return self.msg_source

     

      def getDestination(self):

            return self.target

     

      def getMessageID(self):

            return self.Message_ID

     

      def getVersion(self):

            return self.msg_version

 

 

------------------------------------------------------------------------------ Download Intel&#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Jython-users mailing list Jython-users <at> lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jython-users

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Jython-users mailing list
Jython-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users
Alex Grönholm | 2 Mar 19:46
Picon
Gravatar

Re: import question/problem

2.3.2010 17:36, Chuck Bearden kirjoitti:
> I set up Jython 2.5.1 in the standard, non-stand-alone way on a 64-bit
> CentOS 5.4 server, with the OpenJDK 1.6.0 Java implementation.  I
> can't get the 'from … import *' style of import to work correctly:
>
> $ jython -i
> expr: warning: unportable BRE: `^/': using `^' as the first character
> of the basic regular expression is not portable; it is being ignored
> *sys-package-mgr*: can't create package cache dir,
> '/opt/jython-2.5.1/cachedir/packages'
> Jython 2.5.1 (Release_2_5_1:6813, Sep 26 2009, 13:47:54)
> [OpenJDK 64-Bit Server VM (Sun Microsystems Inc.)] on java1.6.0
> Type "help", "copyright", "credits" or "license" for more information.
>    
>>>> from java.lang import *
>>>> Class
>>>>          
> Traceback (most recent call last):
>    File "<stdin>", line 1, in<module>
> NameError: name 'Class' is not defined
>    
>>>> from java.lang import Class
>>>> Class
>>>>          
> <type 'java.lang.Class'>
>    
>>>>          
> I also tried installing Jython using the JDK from the Sun website as
> well.  This kind of import does work on my Ubuntu 9.04 machine and on
> a Windows machine to which I have access, using Jython 2.5.1. Still, I
> suspect that I messed something up in the install. I can probably code
> around the problem by naming each class I want to import, but now I
> wonder if other things will break.
>
> I didn't spot anything clearly corresponding to this problem in the
> bug system or in the mail archives. Does this look familiar to anyone?
>    
To do package or wildcard imports, jython needs to fill in the package 
cache. In your case, it failed to do so because the current user didn't 
have write access to /opt/jython-2.5.1/cachedir/packages. Was 
/opt/jython2.5.1 where your working directory when you started jython?
> Info on my setup:
>
> $ lsb_release -a
> LSB Version:
> :core-3.1-amd64:core-3.1-ia32:core-3.1-noarch:graphics-3.1-amd64:graphics-3.1-ia32:graphics-3.1-noarch
> Distributor ID: CentOS
> Description:    CentOS release 5.4 (Final)
> Release:        5.4
> Codename:       Final
>
> $ java -version
> java version "1.6.0"
> OpenJDK  Runtime Environment (build 1.6.0-b09)
> OpenJDK 64-Bit Server VM (build 1.6.0-b09, mixed mode)
>
> Thanks for any pointers,
> Chuck
>
> ------------------------------------------------------------------------------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Jython-users mailing list
> Jython-users <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jython-users
>    

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Jython-users mailing list
Jython-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users
Jeff Emanuel | 2 Mar 19:47
Favicon

Re: need clarification on java/jython integration issue please


The root of your problem is that Jython adds syntactic sugar
(called bean property shortcuts) to Java classes (and interfaces)
so that you can replace calling getFoo/setFoo methods with attribute
syntax (.foo).  Since you have both a getLength method and a length
field in your class, there is ambiguity between whether
self.length=0 means accessing the attribute or is a shortcut for
calling self.setLength.  Apparently, the latter interpretation takes
precedence.  Since your interface has a getLength method but no setLength
method, it complains that length is read-only.

The fix, as someone explained before, is not to create fields
for classes that conflict with the bean property shortcuts.
Rename the length field to _length, myLength, aLength, theLength,
or anything else.  You've done that for source, destination, version,
and MessageID.

Sherrell, Dana wrote:
> *Hi –*
> 
> * *
> 
> *I am hoping I can get an explanation regarding an issue I have.  I have 
> found a work around, however I do not understand why the issue is 
> occurring and why the work around even resolves it.  Below I have a very 
> simple interface in Java and a jython object that implements that 
> interface.  If I try something to access the length property from Java 
> by doing:*
> 
> * *
> 
> *      *MessageInterface message = (MessageInterface)factory.createObject();
> 
>       System./out/.println("Message length:" + message.getLength());
> 
>  
> 
> *I get the following error: *
> 
>  
> 
> Exception in thread "main" Traceback (most recent call last):
> 
>   File "__pyclasspath__/message_interface.py", line 90, in __init__
> 
> AttributeError: read-only attr: length
> 
> * *
> 
> * *
> 
> *If I add a setter method for length and expose that through the 
> interface, I get a max recursion depth error.  If I change self.length 
> to instead be self.msg_length the problem goes away.  If I put an 
> underscore in front of length the problem goes away.  I have this same 
> issue with self.source instead of self.msg_source.  However, I don’t 
> have any problems with self.target and other attributes.  Why is it an 
> issue for some attributes and not others? I would like to understand 
> this problem so if anyone can explain what is going on to me I would 
> really appreciate it.*
> 
> * *
> 
> *Thank you.*
> 
> * *
> 
> *public* *interface* MessageInterface {
> 
>      
> 
>       *public* *int* getSource();
> 
>       *public* *int* getDestination();
> 
>       *public* *int* getLength();
> 
>       *public* *int* getVersion();
> 
>       *public* *int* getMessageID();
> 
> }
> 
>  
> 
>  
> 
> class *Message*(MessageInterface):
> 
>       def *__init__*(/self/):
> 
>             /"""_ <at> sig_ Message()"""/
> 
>            
> 
>             /self/.length = 0
> 
>             /self/.msg_version = 0
> 
>             /self/.msg_source = 0
> 
>             /self/.target = 0
> 
>             /self/.Message_ID = 0
> 
>  
> 
>  
> 
>  
> 
> def *getLength*(/self/):
> 
>             return /self/.length
> 
>      
> 
>      
> 
>       def *getSource*(/self/):
> 
>             return /self/.msg_source
> 
>      
> 
>       def *getDestination*(/self/):
> 
>             return /self/.target
> 
>      
> 
>       def *getMessageID*(/self/):
> 
>             return /self/.Message_ID
> 
>      
> 
>       def *getVersion*(/self/):
> 
>             return /self/.msg_version
> 
>  
> 
>  
> 
> 
> ------------------------------------------------------------------------
> 
> ------------------------------------------------------------------------------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Jython-users mailing list
> Jython-users <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jython-users

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
Santosh Tiwari | 2 Mar 20:40
Picon

PythonInterpreter question

This is my first post to this list.

I wish to use Jython in my Java application to evaluate expressions on-the-fly.

I have successfully embedded Jython and can evaluate simple expressions.


I have a question about loops.

Consider this simple expression

a = 1
while a<10:
    a = a + 1

If I pass the entire string (all three lines of code) to the interpreter, it works fine.

PythonInterpreter interp = new PythonInterpreter();
interp.exec(sourceString);

However, if I pass each line separately, then it throws an exception when reading the while statement since it expects some code with indentation after the while statement. The error message is

("mismatched input '<EOF>' expecting INDENT", ('<string>', 3, 11, 'while a<10:\n'))


If I pass each line to the interpreter, then I can inform the user which line has error. If I pass the entire code as a string, then I only have the error message generated by python. If I can get the exact line number which has error, then I could tell that to the user. Alternatively, if I can send each line for execution, then I know the line number which has error. What should I do?


I have another question as well.

The PythonInterpreter object has all the local variables that have been assigned a value during execution. Is there a way I can get a list of all the local variables and their values? Currently, I am parsing the code myself to figure out all the variables that might have been assigned a value and then am asking the PythonInterpreter (Object value = interp.get(variableName)) to fetch the value corresponding to that variable.

Thanks,





------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Jython-users mailing list
Jython-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users
Nicholas Riley | 2 Mar 20:47
Favicon
Gravatar

Re: PythonInterpreter question

In article 
<65fd166e1003021140s675d20c9p332794a4828f79e7 <at> mail.gmail.com>,
 Santosh Tiwari <tiwaris <at> gmail.com> wrote:

> a = 1
> while a<10:
>     a = a + 1
> 
> If I pass the entire string (all three lines of code) to the interpreter, it
> works fine.
> 
> PythonInterpreter interp = new PythonInterpreter();
> interp.exec(sourceString);
> 
> However, if I pass each line separately, then it throws an exception when
> reading the while statement since it expects some code with indentation
> after the while statement. The error message is
> 
> ("mismatched input '<EOF>' expecting INDENT", ('<string>', 3, 11, 'while
> a<10:\n'))
> 
> If I pass each line to the interpreter, then I can inform the user which
> line has error. If I pass the entire code as a string, then I only have the
> error message generated by python. If I can get the exact line number which
> has error, then I could tell that to the user. Alternatively, if I can send
> each line for execution, then I know the line number which has error. What
> should I do?

Send the entire expression and parse the error you get back.  You can't 
"evaluate" partial code like that.  If you'd like to see an example of 
doing this, see PyScriptEngine.scriptException:

https://jython.svn.sourceforge.net/svnroot/jython/trunk/jython/src/org/py
thon/jsr223/PyScriptEngine.java

> I have another question as well.
> 
> The PythonInterpreter object has all the local variables that have been
> assigned a value during execution. Is there a way I can get a list of all
> the local variables and their values? Currently, I am parsing the code
> myself to figure out all the variables that might have been assigned a value
> and then am asking the PythonInterpreter (Object value =
> interp.get(variableName)) to fetch the value corresponding to that variable.

getLocals() seems like it should do exactly what you want.
--

-- 
Nicholas Riley <njriley <at> illinois.edu>

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
Chuck Bearden | 2 Mar 21:06
Picon

Re: import question/problem

2010/3/2 Alex Grönholm <alex.gronholm <at> nextday.fi>:
> 2.3.2010 17:36, Chuck Bearden kirjoitti:
>> I set up Jython 2.5.1 in the standard, non-stand-alone way on a 64-bit
>> CentOS 5.4 server, with the OpenJDK 1.6.0 Java implementation.  I
>> can't get the 'from … import *' style of import to work correctly:
>>
>> $ jython -i
>> expr: warning: unportable BRE: `^/': using `^' as the first character
>> of the basic regular expression is not portable; it is being ignored
>> *sys-package-mgr*: can't create package cache dir,
>> '/opt/jython-2.5.1/cachedir/packages'
>> Jython 2.5.1 (Release_2_5_1:6813, Sep 26 2009, 13:47:54)
>> [OpenJDK 64-Bit Server VM (Sun Microsystems Inc.)] on java1.6.0
>> Type "help", "copyright", "credits" or "license" for more information.
>>
>>>>> from java.lang import *
>>>>> Class
>>>>>
>> Traceback (most recent call last):
>>    File "<stdin>", line 1, in<module>
>> NameError: name 'Class' is not defined
>>
>>>>> from java.lang import Class
>>>>> Class
>>>>>
>> <type 'java.lang.Class'>
>>
>>>>>
>> I also tried installing Jython using the JDK from the Sun website as
>> well.  This kind of import does work on my Ubuntu 9.04 machine and on
>> a Windows machine to which I have access, using Jython 2.5.1. Still, I
>> suspect that I messed something up in the install. I can probably code
>> around the problem by naming each class I want to import, but now I
>> wonder if other things will break.
>>
>> I didn't spot anything clearly corresponding to this problem in the
>> bug system or in the mail archives. Does this look familiar to anyone?
>>
> To do package or wildcard imports, jython needs to fill in the package
> cache. In your case, it failed to do so because the current user didn't
> have write access to /opt/jython-2.5.1/cachedir/packages. Was
> /opt/jython2.5.1 where your working directory when you started jython?

Ah, thanks.  I think I see what is going on now.  Based on this official
FAQ, it appears to be safe to make the cachedir a+rw.  It looks like one
alternative is to set a custom cachedir in ~/.jython.

Tusen tack för svaret!
Chuck

>> Info on my setup:
>>
>> $ lsb_release -a
>> LSB Version:
>> :core-3.1-amd64:core-3.1-ia32:core-3.1-noarch:graphics-3.1-amd64:graphics-3.1-ia32:graphics-3.1-noarch
>> Distributor ID: CentOS
>> Description:    CentOS release 5.4 (Final)
>> Release:        5.4
>> Codename:       Final
>>
>> $ java -version
>> java version "1.6.0"
>> OpenJDK  Runtime Environment (build 1.6.0-b09)
>> OpenJDK 64-Bit Server VM (build 1.6.0-b09, mixed mode)
>>
>> Thanks for any pointers,
>> Chuck

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Jython-users mailing list
Jython-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users
Nicholas Riley | 2 Mar 21:26
Favicon
Gravatar

Re: PythonInterpreter question

> I thought of parsing the error message myself, but the error message that is 
> returned might be too complex at times for me to correctly parse it. My 
> understanding is that the error message is constructed at some point and if I 
> can get hold of the objects from which the error message is constructed, I 
> could then print the correct output.

Did you take a look at the code I pointed you to?  That's exactly what 
it does.

> I checked getLocals() method and it returns a PyObject object. It has 
> __find_item__ and __get_item__ methods. I need little more help to extract 
> all the locals that exist.

It's a Python mapping object (most likely a PyStringMap).  It obeys the 
normal Python mapping protocol, so you can use iteritems() or items() to 
get an iterator or list of (key, value) tuples out of it.
--

-- 
Nicholas Riley <njriley <at> illinois.edu>

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev

Gmane