Jython newbie question

Christopher Myers chris.myers at ingenta.com
Thu Jul 25 11:12:55 EDT 2002


I just downloaded Maxq (http://www.bitmechanic.com/projects/maxq/)
- a web testing application, which is written in Java, and it uses
Jython for a scripting language.  
I've  never used Jython before, and consider myself an intermediate
Python programmer.

It seems I can code in normal Python when editting the Jython scripts
generated by Maxq, with one BIG exception:  I can't import standard
Python modules, such as 'string'.

Anybody know what I'm doing wrong?

The code is executed from a shell script following:

#!/bin/sh
#
# maxq -- Startup script for MaxQ on *nix
#
# shamelessly stolen from the ant shell script
#
#

## resolve links - $0 may be a link to our home
PRG=$0
progname=`basename $0`

while [ -h "$PRG" ] ; do
    ls=`ls -ld "$PRG"`
    link=`expr "$ls" : '.*-> \(.*\)$'`
    if expr "$link" : '.*/.*' > /dev/null; then
    PRG="$link"
    else
    PRG="`dirname $PRG`/$link"
    fi
done

MAXQ=`dirname "$PRG"`/..

CLASSPATH=$MAXQ/lib/maxq.jar:$MAXQ/lib/junit.jar:$MAXQ/lib/jython.jar:$MAXQ/lib\/HTTPClient.zip
export CLASSPATH

java com.bitmechanic.maxq.Main "$@"


And the test script begins as follows:
(My addition is the 'import time, string' line).  
Note - there are no complaints about the time module, only the string
module.

# imports
from com.bitmechanic.maxq import HttpTestCase
from junit.textui import TestRunner
from java.util import HashMap
import time, string

# defintition of test class
class MaxQTest(HttpTestCase):
    def __init__(self):
        HttpTestCase.__init__(self, "")
        self.page = ""

(etc . . .)

-- 
Christopher Myers, Graduate Software Developer 
Ingenta, Inc.
12 Bassett St.
Providence, RI  02903
ph:  401.331.2014 x 102
em:  chris.myers at ingenta.com
aim: chrismyers001



More information about the Python-list mailing list