Sunday 15 February 2015

python - Weird load_module input parameters -



python - Weird load_module input parameters -

i have written custom python module loader/importer has find_module , load_module methods. run bit of problem when want import cherrypy module it.

in

cherrypy/__ init __.py

it has lines such as:

from cherrypy._cpcompat import urljoin

when utilize default python importer, adding false importer such as:

class fakeimporter(object): def find_module(self, module_name, path=none): print module_name, path homecoming none

i next calls:

find_module('cherrypy')

find_module('cherrypy.cherrypy')

find_module('cherrypy._cpcompat')

sounds normal. when utilize custom loader calls:

find_module('cherrypy')

find_module('cherrypy.cherrypy')

find_module('cherrypy.cherrypy._cpcompat')

what causing issue? handling load_module('cherrypy.cherrypy') wrong? load module memory, set cherrypy.path ['cherrypy'], set file 'cherrypy', loader loader, name 'cherrypy' , package 'cherrypy'. there missing?

i figured out wrong: in find_module returned importer, blocked absolute imports ever happening.

python python-2.7 package python-import

No comments:

Post a Comment