[Tutor] import by filename
flaxeater at yahoo.com
Thu Aug 26 22:28:29 CEST 2004
> Since you don;t show us any code that you've triedits hard to know
> what you don't understand. But the way I read that description
> I'd guess a typical call sequence would look like:
> myfile = open('/a/long/file/name/to/file.ext')
> load_source('mymodule', # the name by which we will refer to it
> our code
> '/a/long/file/name/to/file.ext', # the full pathname
> myFile) # the open file object
> mymodule.foo() # a call to a function in the new module
> Is that what you are doing?
> What happens exactly?
Well I'm sorry, I thought I would ask on the list to see if anyone
had done this before and could give me an easy answer, shame on me.
It turns out the documentation is very wrong. this is the code that
this outputs a dictionary in my test module.
Apperntly this function returns a module object. So I can infact us
it thus. The reason I want this is so that I can have a directory
with configuration files for each page on my website. Each page is
it's own object with certain relationships with other.
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
More information about the Tutor