Need clue with import hackery

Steven D. Majewski sdm7g at Virginia.EDU
Thu Aug 2 21:21:26 EDT 2001


On Fri, 3 Aug 2001, Richard Jones wrote:

> Hey, this is a fun conversation I'm having with myself here :)

I'm glad you're enjoying it.
I haven't been able to get a word in, myself!

> >>> import imp, sys
> >>> imp.load_module('instance', None, '/tmp/roundup', ('', '', 5))
> <module 'instance' from '/tmp/roundup/__init__.pyc'>
> >>> sys.modules['roundup']
> <module 'roundup' from 'roundup/__init__.pyc'>

There's also:

     imp.load_package( name, path ) 

( which doesn't appear to be in the documentation. ) 


You might also want to add: 

	sys.modules['instance'] = instance 


But I'm not quite sure what you're doing, so maybe not. 

What is 'roundup' ? 

-- Steve Majewski







More information about the Python-list mailing list