dynamic module loading via __import__, nonetype?

John Allman allmanj at cp.dias.ie
Wed Oct 18 04:43:30 EDT 2006


Gabriel Genellina wrote:
> At Monday 16/10/2006 13:33, John Allman wrote:
> 
>> If i manually import a module, this method works a treat, however if i
>> attempt to dynamically load a module at runtime the create method fails
>> with the following error:
>>
>> TypeError: 'NoneType' object is not callable
> 
> Can you cut down a reproducible test case, with *only* this behavior and
> nothing more?
>

Hi Gabriel

Thanks for the reply. I actually spotted my error (simple, stupid that i
hadn't noticed). I had the create method creating an object if it could
find a suitable class and importing a suitable class if it couldn't find
one. I rather stupidly forgot to actually create an object after
importing the class!

I was completely stuck - it's amazing what a night's sleep will do for you!

Thanks,

John



More information about the Python-list mailing list