Re: Hacking the scope to pieces



Maybe I misunderstood what you meant, but I couldn't quite manage to
get this one working....

My initial hopes about __import__() were that I could define it inside
my new module (moduleLoader) and, when the module is imported, it could
do stuff (like try to hold onto the vars() and globals() from the
importing scope). However, I couldn't get it to import...

The route I've ended up going (which is just about as simple) is just
to return the new module from moduleLoader.loadModule, so my loading
code is:

import moduleLoader
myModule = moduleLoader.loadModule("myModule",
os.getenv("MODULE_VERSION"))

I've also switched over to using 'inp' for this, rather than creating a
compiler string - much nicer....

Anyway, thanks Skip

--
Hugh

.



Relevant Pages

  • Re: Singleton
    ... I now see that I misunderstood where the problem was and I got ... useful information about how importing stuff works. ... My problem is solved and I'm grateful for your help. ...
    (comp.lang.python)
  • More file listing
    ... be simple to isolate those lines in the file when importing stuff. ... Worth ... Good luck! ... Prev by Date: ...
    (microsoft.public.windowsxp.basics)
  • Re: Injecting code into a function
    ... script or importing it from a module but it returns None. ... strange... ... George ... Prev by Date: ...
    (comp.lang.python)
  • Re: Import into outlook express 6.0
    ... Where are you importing the file from? ... > emptyor an application is running that has the required files ... Prev by Date: ...
    (microsoft.public.windowsxp.general)
  • Palm P and Outlook Cal. keep importing and exporting same event
    ... My Palm Pilot and Outlook calendar keep importing and exporting same event to ... I have multiple enteries of same event on each. ... Prev by Date: ...
    (microsoft.public.access.gettingstarted)