Re: Issue with modulefinder - jython 2.5.3

Pradeep Badiger <[email protected]>
Newsgroups gmane.comp.lang.jython.devel
Message-ID <DDFE6B42B194104F903A334F685DC89919441A68@mbx025-wd-ca-2.exch025.domain.local>
Thanks Jim for the quick reply.

Do you know of any module or library that can provide me the list of modules used by  a script that I can embed within my java application?

Thanks,
Pradeep V.B.

From: [email protected] [mailto:[email protected]] On Behalf Of Jim Baker
Sent: Sunday, February 08, 2015 1:01 PM
To: Pradeep Badiger
Cc: [email protected]
Subject: Re: [Jython-dev] Issue with modulefinder - jython 2.5.3

Two problems:

1. Standalone has issues for inspecting Lib as a filesystem, see http://bugs.jython.org/issue2143

2. But more importantly, modulefinder itself depends on Python bytecode (see https://github.com/jythontools/jython/blob/master/lib-python/2.7/modulefinder.py#L19), which is not compatible with Jython.

This is why modulefinder is excluded in 2.7 (https://github.com/jythontools/jython/blob/master/CPythonLib.includes). Sorry it's in 2.5.

I suppose it would be possible to port modulefinder to Jython, but I don't know scope. It could be a useful PyPI project as well.

- Jim

On Sun, Feb 8, 2015 at 9:59 AM, Pradeep Badiger <[email protected]<mailto:[email protected]>> wrote:
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]<mailto:[email protected]>
https://lists.sourceforge.net/lists/listinfo/jython-dev



--
- Jim

jim.baker@{colorado.edu<http://colorado.edu>|python.org<http://python.org>|rackspace.com<http://rackspace.com>|zyasoft.com<http://zyasoft.com>}
twitter.com/jimbaker<http://twitter.com/jimbaker>
github.com/jimbaker<http://github.com/jimbaker>
bitbucket.com/jimbaker<http://bitbucket.com/jimbaker>

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
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.