Jython newbie question

Martin Franklin mfranklin1 at gatwick.westerngeco.slb.com
Thu Jul 25 12:44:16 EDT 2002


On Thursday 25 Jul 2002 3:12 pm, Christopher Myers wrote:
> 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.
>
> 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,
I can;t answer your question but there is a difference between the time 
module and the string module as shown here

[bpse at m-franklin bpse]$ jython
Jython 2.0 on java1.3.0 (JIT: null)
Type "copyright", "credits" or "license" for more information.
>>> 
>>> import string
>>> string.__file__
'/usr/python/Jython/Lib/string.py'
>>> import time
>>> time.__file__
Traceback (innermost last):
  File "<console>", line 1, in ?
AttributeError: class 'org.python.modules.time' has no attribute '__file__'
>>> 
>>> time
<jclass org.python.modules.time at 3891803>
>>> string
<module string at 305666>
>>> 


time loks like it's a builtin module and string is a Library module. So I 
would think there is somthing wrong with the sys.path 

Can you do the above at the jython command line?

Cheers
Martin








More information about the Python-list mailing list