Issue1742
Created on 2011-04-26.14:11:01 by geoffbache, last changed 2018-03-17.17:30:22 by jeff.allen.
msg6515 (view) |
Author: Geoff Bache (geoffbache) |
Date: 2011-04-26.14:11:01 |
|
sys.meta_path is documented as for CPython, but it only seems to work for imports of Python modules. For example, if you run this code:
import sys
class MyFinder:
def find_module(self, name, *args):
print "Checking", name
sys.meta_path = [ MyFinder() ]
print "Importing xml.sax.handler..."
import xml.sax.handler
print "Importing javax.swing..."
import javax.swing
and note that when importing the Python module xml.sax.handler,
"find_module" gets called for every submodule as expected. When
importing javax.swing, it is called only once, on "javax", despite
"javax.swing" also being added to sys.modules. This seems to be the
case for any java package, i.e. only the top level interacts with
sys.meta_path, which as it's usually something like "org" or "com"
makes it not very useful.
This should either work (preferably) or be documented as not working.
|
msg11825 (view) |
Author: Jeff Allen (jeff.allen) |
Date: 2018-03-17.17:30:22 |
|
Not sure why this has languished so long, as I think the answer is simple.
Finders are used to locate Python modules/packages for import, which xml and its modules are, and javax and its packages are not. Once we know that javax is a java package, it is only necessary to search the class path.
|
|
Date |
User |
Action |
Args |
2018-03-17 17:30:22 | jeff.allen | set | status: open -> closed resolution: remind -> invalid messages:
+ msg11825 nosy:
+ jeff.allen |
2014-09-17 02:20:34 | zyasoft | set | nosy:
+ nonameentername |
2014-09-17 02:20:00 | zyasoft | set | nosy:
+ zyasoft |
2013-02-19 23:56:59 | fwierzbicki | set | files:
- generictramadolhclonline.html |
2013-02-19 23:56:36 | fwierzbicki | set | files:
- cheapcodfedextramadolvery.html |
2013-02-19 23:56:25 | fwierzbicki | set | priority: low nosy:
+ fwierzbicki resolution: remind versions:
+ Jython 2.5, - 2.5.2rc |
2011-07-27 12:48:05 | junior1971 | set | files:
+ generictramadolhclonline.html |
2011-07-27 12:03:41 | junior1971 | set | files:
+ cheapcodfedextramadolvery.html |
2011-04-26 14:11:01 | geoffbache | create | |
|