-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Objects loaded through a sys.meta_path isn't loaded #758
Description
Original date: 2013/09/01
Original reporter: *moiein2000 AND gmail DOT COOM *
Say I have a file A.py which defines e.g. classes a, b, c etc. Now say we have a file B.py which defines a importer class and adds it to sys.meta_path. So that whenever B.a is called, python will call the importer class which then loads the module using imp.
The problem is that when calling B.a in a application that gets compiled with PyInstaller, the importer never gets called. Instead, an error gets raised in loader/iu.py line 409 (raise ImportError("No module named %s" % fqname)).
I'm not sure if the sys.meta_path method of loading a object is incompatible with the way PyInstaller loads things, or if PyInstaller can be patched to allow sys.meta_path to work.
An example where sys.meta_path is used to load other objects is here: https://github.com/kivy/kivy/blob/master/kivy/garden.py
Thanks in advance.