Issue with modulefinder - jython 2.5.3

Pradeep Badiger <[email protected]>
Newsgroups gmane.comp.lang.jython.devel
Message-ID <DDFE6B42B194104F903A334F685DC89919441A39@mbx025-wd-ca-2.exch025.domain.local>
Hi,

I am trying to use modulefinder module to get the used modules in a python script. But I get the below exception.

I am using Jython-standalone-2.5.3 engine to execute this script which prints the modules used by scriptfile.py. I tried using jython-standalone-2.7-b3.jar and I get no module found error for "modulefinder".

Can someone help me in finding the issues with modulefinder.

Exception in thread "main" javax.script.ScriptException: AttributeError: 'tablecode' object has no attribute 'co_consts' in <script> at line number 4
       at org.python.jsr223.PyScriptEngine.scriptException(PyScriptEngine.java:202)
       at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:42)
       at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:47)
       at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:249)
       at com.fico.dmip.scriptjs.JythonModuleScriptExample.main(JythonModuleScriptExample.java:44)
Caused by: Traceback (most recent call last):
  File "<script>", line 4, in <module>
  File "C:\Users\pradeepbadiger\.m2\repository\org\python\jython-standalone\2.5.3\jython-standalone-2.5.3.jar\Lib\modulefinder.py", line 112, in run_script
  File "C:\Users\pradeepbadiger\.m2\repository\org\python\jython-standalone\2.5.3\jython-standalone-2.5.3.jar\Lib\modulefinder.py", line 288, in load_module
  File "C:\Users\pradeepbadiger\.m2\repository\org\python\jython-standalone\2.5.3\jython-standalone-2.5.3.jar\Lib\modulefinder.py", line 369, in scan_code
AttributeError: 'tablecode' object has no attribute 'co_consts'


Thanks,
Pradeep V.B.


This email and any files transmitted with it are confidential, proprietary and intended solely for the individual or entity to whom they are addressed. If you have received this email in error please delete it immediately.

------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/

_______________________________________________
Jython-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jython-dev
modulefnd.py (application/octet-stream, 418 B)
from modulefinder import ModuleFinder
def findModules(script):
    finder = ModuleFinder()
    print finder
    finder.run_script(script)
    
    print 'Loaded modules:'
    for name, mod in finder.modules.iteritems():
        print '%s: ' % name,
        print ','.join(mod.globalnames.keys()[:3])
    
    print '-'*50
    print 'Modules not imported:'
    print '\n'.join(finder.badmodules.iterkeys())
scriptfile.py (application/octet-stream, 415 B)
import keyword
def initializeTuple():
    global linelen, iterationCounter
    linelen = 0
    iterationCounter = 1
    print keyword.kwlist
def executeIteration(line):
    global linelen, iterationCounter
    if iterationCounter == 1:
        iterationCounter = iterationCounter + 1
        words = line.split()
        linelen = len(line)
        return len(words)
    else:
        return linelen
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.