Message93
Just got introduced to JPython. Looks great. Just wanted help on a small
problem.
I wanted to use a package with the following directory structure:
com/
__init__.py
ccs/
__init__.py
util/
__init__.py
Test.py
All the __init__.py files are empty. I now set JPYTHON_PATH to the location of
com.
At the jpython prompt I type
import com.ccs.util.Test
which is when a java.lang.StackOverflowError is thrown and the stack trace
displayed
contains:
...
at org.python.core.PackageManager.lookupName(PackageManager.java:95)
at org.python.core.PyModule.__findattr__(PyModule.java:41)
at org.python.core.imp.importName(imp.java:434)
at org.python.core.imp.importOne(imp.java:447)
at com.ccs.util.TestCase$py.f$0(TestCase.py)
at com.ccs.util.TestCase$py.call_function(TestCase.py)
at org.python.core.PyTableCode.call(PyTableCode.java:155)
at org.python.core.imp.createFromCode(imp.java:149)
at org.python.core.imp.createFromSource(imp.java:140)
at org.python.core.imp.loadFromPath(imp.java:288)
at org.python.core.PyModule.__findattr__(PyModule.java:33)
at org.python.core.PyObject.__getattr__(PyObject.java:597)
at org.python.core.imp.importName(imp.java:406)
at org.python.core.imp.importName(imp.java:443)
at org.python.core.imp.importOne(imp.java:447)
at org.python.pycode._pyx1.f$0(<console>)
at org.python.pycode._pyx1.call_function(<console>)
at org.python.core.PyTableCode.call(PyTableCode.java:155)
at org.python.core.Py.runCode(Py.java:965)
at org.python.core.Py.exec(Py.java:979)
at org.python.util.PythonInterpreter.exec(PythonInterpreter.java:122)
at org.python.util.InteractiveInterpreter.runcode(InteractiveInterpreter.java:82)
at org.python.util.InteractiveInterpreter.runsource(InteractiveInterpreter.java:63)
at org.python.util.InteractiveInterpreter.runsource(InteractiveInterpreter.java:42)
at org.python.util.InteractiveConsole.push(InteractiveConsole.java:84)
at org.python.util.InteractiveConsole.interact(InteractiveConsole.java:63)
at org.python.util.jpython.main(jpython.java:141)
The python class is very simple:
import sys
class TestCase:
def __init__:
print 'Testing'
When I tried importing com, I find that doing com.__dict__ at the prompt gives:
{'__name__': 'com', 'sun': <java package com.sun at 499530568>}
Was wondering whether it had anything to do with the fact that jpython probably
went through my classpath and imported the files it found.
|
|
| Date |
User |
Action |
Args |
| 2008-02-20 17:16:40 | admin | link | issue222824 messages |
| 2008-02-20 17:16:40 | admin | create | |
|