Load Arbitrary Script as Module?

Fred Gansevles gansevle at cs.utwente.nl
Wed May 10 09:26:32 CEST 2000


In article <slrn8hgdub.tk9.scarblac-spamtrap at flits104-37.flits.rug.nl>,
  scarblac-rt at pino.selwerd.nl wrote:
> rgb122 at my-deja.com wrote in comp.lang.python:
> > Is there a way to load a module given a full filepath? Something
like:
> >
> > driver = LoadModule("C:\\Stuff\\sample.py")
> > driver.someFunction()
>
> driver = __import__("C:\\Stuff\\sample")
>
or maybe:

 sys.path.insert (0, r"C:\Stuff")
 import sample
 driver = sample

> --
> Remco Gerlich,  scarblac at pino.selwerd.nl
>   Murphy's Rules, "I sense... golden arches":
>    In Original D&D, some swords had the ability to 'detect meal and
what
>    kind.'
>
--
-----------------------------------------------------------------------
----          Linux/Windows-NT/IntraNetware Administrator          ----
-- Whenever it sounds simple, I've probably missed something! ... Me --
-----------------------------------------------------------------------


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list