adam goucher | 1 May 12:27
Picon

super() with java classes

While tinkering with the code in the 'NullPointException with getImage' 
thread, I got the following exception:

>>> class test(java.applet.Applet):
...     def __init__(self):
...         super(test, self).__init__()
...         self.pic = 
self.getImage(java.net.URL("http://java.sun.com/graphics/people.gif"))
...
>>> b = test()
Traceback (innermost last):
  File "<console>", line 1, in ?
  File "<console>", line 3, in __init__
TypeError: super: argument 1 must be type

The mighty Goog explains that error is when you try to use super() with an 
old-style class. Does this imply that *all* java super classes are 
considered 'old'? I've never had the need to use super() in jython yet.

-adam 

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
astigmatik | 2 May 04:33
Picon

Re: NullPointException with getImage

Shouldn't that be:

class test(java.applet.Applet):
   def __init__(self):
      self.pic = ..

And then:

a = test() # This would "call" the __init__ method..

On Thu, May 1, 2008 at 6:11 AM, Chris Bryan <chris <at> cmbryan.com> wrote:
> Thanks for the quick response!  However, no joy yet, see below... I
>  must be really missing something, apologies for my dullness...
>
>  Chris
>
>  -----
>
>
>  >>> class test(java.applet.Applet):
>  ...     def init(self):
>  ...             self.pic =
>  self.getImage(java.net.URL("http://java.sun.com/graphics/people.gif"))
>  ...

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
(Continue reading)

astigmatik | 2 May 04:38
Picon

Re: super() with java classes

>From http://www.jython.org/Project/userguide.html#calling-methods-in-your-superclass

"This works with the majority of methods, but protected methods cannot
be called from
subclasses in this way. Instead you have to use the
"self.super__foo()" call style."

But in your case, I think you should do:

from java.applet import Applet
class test(Applet):
   def __init__(self):
      Applet.__init__(self)

On Thu, May 1, 2008 at 6:27 PM, adam goucher <adam_goucher <at> hotmail.com> wrote:
> While tinkering with the code in the 'NullPointException with getImage'
>  thread, I got the following exception:
>
>  >>> class test(java.applet.Applet):
>  ...     def __init__(self):
>  ...         super(test, self).__init__()
>  ...         self.pic =
>  self.getImage(java.net.URL("http://java.sun.com/graphics/people.gif"))
>  ...
>  >>> b = test()
>  Traceback (innermost last):
>   File "<console>", line 1, in ?
>   File "<console>", line 3, in __init__
>  TypeError: super: argument 1 must be type
>
(Continue reading)

Favicon

Location of __run__.py

Hi all,
 
When creating an application using the standalone jar method, I have seen instructions stating to place the startup script __run__.py at the root of the jar.
However, whenever I am call
 
java -jar jython.jar
 
it is starting up to the command interface in the normal way, not running my __run__.py script. What am I missing?
 
Many thanks,
 
Gareth
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Jython-users mailing list
Jython-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users
Ivan Horvath | 5 May 14:07
Picon

Re: Location of __run__.py

Dear Gareth,

the __run__.py is not including in the jar file. it is located next to the jar file.
and this the batch file, which starts the application:
<at> echo off

setlocal

set DIR_JAVA=C:\Program Files\Java\jdk1.5.0_12\

set ARGS=
:loop
if [%1] == [] goto rundemo
        set ARGS=%ARGS% %1
        shift
        goto loop

:rundemo
"%DIR_JAVA%bin\java.exe" -Xms1024M -Xmx1024M -XX:PermSize=256M -XX:MaxPermSize=256M -jar SchedulerIF_sp5.jar __run__.py %ARGS%

endlocal

Ivan

On Fri, May 2, 2008 at 4:56 PM, DOUTCH GARETH-GDO003 <Gareth.Doutch <at> motorola.com> wrote:
Hi all,
 
When creating an application using the standalone jar method, I have seen instructions stating to place the startup script __run__.py at the root of the jar.
However, whenever I am call
 
java -jar jython.jar
 
it is starting up to the command interface in the normal way, not running my __run__.py script. What am I missing?
 
Many thanks,
 
Gareth

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Jython-users mailing list
Jython-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users




--
"De sagittis hungarorum libera nos, Domine!" - "A magyarok nyilaitól ments meg Uram minket!"

http://www.freeweb.hu/pillesoft
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Jython-users mailing list
Jython-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users
Dave Kuhlman | 5 May 20:40
Gravatar

Re: Location of __run__.py

DOUTCH GARETH-GDO003 <Gareth.Doutch <at> motorola.com> writes:

> 
> 
> Hi 
> all,
> 
>  
> When creating an 
> application using the standalone jar method, I have seen instructions stating 
to 
> place the startup script __run__.py at the root of the jar. 
> 
> However, whenever I am call 
>  
> java -jar jython.jar 
>  
> it is starting up to 
> the command interface in the normal way, not running my __run__.py script. 
What 
> am I missing?

Yes, you can put your __run__.py in you jar file (at the root).  But there are 
a couple of additional considerations.

Here are a few points that might help:

1. When you start your jar, in order to kick off the __run__.py file, use the 
following at the command line:

    $ java org.python.util.jython -jar myjar.jar

2. The "if __name__== '__main__':" idiom does not seem to work.  You will have 
to use something in __run__.py that starts your app unconditionally.

3. One easy way to build a jar to which you add your __run__.py and other 
application specific code is by using the Jython installer.  There is an option 
to create a standalone jar file.  When running the installer in GUI mode, that 
option is a couple of screens in.  When running in silent mode you can use 
something like the following:

    $ java -jar jython_installer-2.2.1.jar -s -d Tmp -t standalone

Run the following for help:

    $ java -jar jython_installer-2.2.1.jar --help

4. There is a bit more about deployment and building jars etc here:

    http://wiki.python.org/jython/LearningJython#deployment-and-distribution

By the way, I wrote that "Deployment and Distribution" section of the Wiki, 
with the help of others.  So, if you find any errors in it or things that need 
to be added, please let me know, or fix it yourself.

Hope this helps.

- Dave

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Jython-users mailing list
Jython-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users
Fabio Zadrozny | 7 May 16:16
Picon

Pydev 1.3.16 Released

Hi All,

Pydev and Pydev Extensions 1.3.16 have been released

Details on Pydev Extensions: http://www.fabioz.com/pydev
Details on Pydev: http://pydev.sf.net
Details on its development: http://pydev.blogspot.com

Release Highlights in Pydev Extensions:
-----------------------------------------------------------------

* Code Analysis: __path__ Not correctly found on some situations.
* Local rename (ctrl+2+r): Positions correctly ordered for tabbing.

Release Highlights in Pydev:
----------------------------------------------

* Interactive console: help() works
* Interactive console: context information showing in completions
* Interactive console: backspace will also delete the selected text
* Interactive console: ESC does not close the console when in floating
mode anymore
* Code completion: calltips context info correctly made 'bold'
* Code completion: variables starting with '_' do not come in import *
* Code completion: can be requested for external files (containing system info)
* Code completion: fixed recursion condition
* Code completion: egg file distributed with dll that has a source
module with the same name only with a __bootstrap__ method now loads
the dll instead of the source module (e.g.: numpy egg)
* Debugger: Step over/Step return can now execute with untraced frames
(much faster)
* Debugger: Problem when handling thread that had no context traced
and was directly removed.
* Launching: F9 will reuse an existing launch instead of creating a
new one every time
* Launching: The default launch with Ctrl+F11 will not ask again for
the launch associated with a file (for new launches -- old launches
should be deleted)
* Project Explorer: fixed integration problems with CDT (and others)
* Launch: console encoding passed as environment variable (no longer
written to the install location)
* More templates for "surround with" (Ctrl+1)
* Previous/next method could match 'class' and 'def' on invalid location
* Outline: Assign with multiple targets is recognized
* Bug fix for pydev package explorer when refreshed element parent was null

What is PyDev?
---------------------------

PyDev is a plugin that enables users to use Eclipse for Python and
Jython development -- making Eclipse a first class Python IDE -- It
comes with many goodies such as code completion, syntax highlighting,
syntax analysis, refactor, debug and many others.

Cheers,

-- 
Fabio Zadrozny
------------------------------------------------------
Software Developer

ESSS - Engineering Simulation and Scientific Software
http://www.esss.com.br

Pydev Extensions
http://www.fabioz.com/pydev

Pydev - Python Development Enviroment for Eclipse
http://pydev.sf.net
http://pydev.blogspot.com

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
Favicon

Re: Location of __run__.py

Hi Dave,

I'm getting the following error whenever I launch:

$ java org.python.util.jython -jar jython.jar

Using the jar created with the standalone jar with __run__.py at the root:

Exception in thread "main" java.lang.NoClassDefFoundError: org/python/util/jython
Caused by: java.lang.ClassNotFoundException: org.python.util.jython
	at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
	at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)

I've no idea what I'm doing wrong.

Cheers,
Gareth

-----Original Message-----
From: jython-users-bounces <at> lists.sourceforge.net
[mailto:jython-users-bounces <at> lists.sourceforge.net] On Behalf Of Dave Kuhlman
Sent: 05 May 2008 19:40
To: jython-users <at> lists.sourceforge.net
Subject: Re: [Jython-users] Location of __run__.py

DOUTCH GARETH-GDO003 <Gareth.Doutch <at> motorola.com> writes:

> 
> 
> Hi
> all,
> 
>  
> When creating an
> application using the standalone jar method, I have seen instructions 
> stating
to 
> place the startup script __run__.py at the root of the jar. 
> 
> However, whenever I am call
>  
> java -jar jython.jar
>  
> it is starting up to
> the command interface in the normal way, not running my __run__.py script. 
What 
> am I missing?

Yes, you can put your __run__.py in you jar file (at the root).  But there are a couple of additional considerations.

Here are a few points that might help:

1. When you start your jar, in order to kick off the __run__.py file, use the following at the command line:

    $ java org.python.util.jython -jar myjar.jar

2. The "if __name__== '__main__':" idiom does not seem to work.  You will have to use something in __run__.py
that starts your app unconditionally.

3. One easy way to build a jar to which you add your __run__.py and other application specific code is by using
the Jython installer.  There is an option to create a standalone jar file.  When running the installer in GUI
mode, that option is a couple of screens in.  When running in silent mode you can use something like the following:

    $ java -jar jython_installer-2.2.1.jar -s -d Tmp -t standalone

Run the following for help:

    $ java -jar jython_installer-2.2.1.jar --help

4. There is a bit more about deployment and building jars etc here:

    http://wiki.python.org/jython/LearningJython#deployment-and-distribution

By the way, I wrote that "Deployment and Distribution" section of the Wiki, with the help of others.  So, if
you find any errors in it or things that need to be added, please let me know, or fix it yourself.

Hope this helps.

- Dave

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event.
There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Jython-users mailing list
Jython-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
David Handy | 7 May 17:35
Picon
Favicon

Re: Location of __run__.py

This advice, given below:

    java org.python.util.jython -jar myjar.jar

is incorrect. If you just run java without any arguments, it will tell you
what went wrong:

C:\>java
Usage: java [-options] class [args...]
           (to execute a class)
   or  java [-options] -jar jarfile [args...]
           (to execute a jar file)
...

In other words, you either set up the classpath to include the jar file, and then run java with the class name
containing your main Java method, OR you use the -jar option, BUT NOT BOTH IN THE SAME COMMAND LINE.

For example, you can run:

java -classpath myjar.jar org.python.util.jython

OR

java -jar myjar.jar

I hope this helps-
David H

-----Original Message-----
From: jython-users-bounces <at> lists.sourceforge.net
[mailto:jython-users-bounces <at> lists.sourceforge.net] On Behalf Of DOUTCH GARETH-GDO003
Sent: Wednesday, May 07, 2008 11:09 AM
To: jython-users <at> lists.sourceforge.net
Subject: Re: [Jython-users] Location of __run__.py

Hi Dave,

I'm getting the following error whenever I launch:

$ java org.python.util.jython -jar jython.jar

Using the jar created with the standalone jar with __run__.py at the root:

Exception in thread "main" java.lang.NoClassDefFoundError: org/python/util/jython
Caused by: java.lang.ClassNotFoundException: org.python.util.jython
        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)

I've no idea what I'm doing wrong.

Cheers,
Gareth

-----Original Message-----
From: jython-users-bounces <at> lists.sourceforge.net
[mailto:jython-users-bounces <at> lists.sourceforge.net] On Behalf Of Dave Kuhlman
Sent: 05 May 2008 19:40
To: jython-users <at> lists.sourceforge.net
Subject: Re: [Jython-users] Location of __run__.py

DOUTCH GARETH-GDO003 <Gareth.Doutch <at> motorola.com> writes:

>
>
> Hi
> all,
>
>
> When creating an
> application using the standalone jar method, I have seen instructions
> stating
to
> place the startup script __run__.py at the root of the jar.
>
> However, whenever I am call
>
> java -jar jython.jar
>
> it is starting up to
> the command interface in the normal way, not running my __run__.py script.
What
> am I missing?

Yes, you can put your __run__.py in you jar file (at the root).  But there are a couple of additional considerations.

Here are a few points that might help:

1. When you start your jar, in order to kick off the __run__.py file, use the following at the command line:

    $ java org.python.util.jython -jar myjar.jar

2. The "if __name__== '__main__':" idiom does not seem to work.  You will have to use something in __run__.py
that starts your app unconditionally.

3. One easy way to build a jar to which you add your __run__.py and other application specific code is by using
the Jython installer.  There is an option to create a standalone jar file.  When running the installer in GUI
mode, that option is a couple of screens in.  When running in silent mode you can use something like the following:

    $ java -jar jython_installer-2.2.1.jar -s -d Tmp -t standalone

Run the following for help:

    $ java -jar jython_installer-2.2.1.jar --help

4. There is a bit more about deployment and building jars etc here:

    http://wiki.python.org/jython/LearningJython#deployment-and-distribution

By the way, I wrote that "Deployment and Distribution" section of the Wiki, with the help of others.  So, if
you find any errors in it or things that need to be added, please let me know, or fix it yourself.

Hope this helps.

- Dave

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event.
There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Jython-users mailing list
Jython-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Jython-users mailing list
Jython-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
Adrian Sosialuk | 3 May 22:14

getClass() on java instance

Hi everyone,

I don't quite understand why calling getClass() method on
a java instance returns that class object - not Class class
object, so i.e:

import java.lang.Object as Object
import java.io.File as File

o = Object()
f = File("test")

o.getClass() # <jclass java.lang.Object at 24806129>
f.getClass() # <jclass java.io.File at 26062828>

So - I'm getting Object and File respectively, instead of
Class object. Could someone please explain me why it is so ?
Why I can't get an instance to Class object ?

Thanks,

Adrian

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone

Gmane