[IPython-user] About import_mod.

Fernando Perez fperez at colorado.edu
Wed Mar 31 02:32:49 CST 2004


Andrea Riciputi wrote:
> Hi,
> I'm trying to personalize IPython writing an rc file by my own, 
> following the well documented rc files that I've found in ~/.ipython. 
> But I failed in importing a module with an alternative name, I mean I'd 
> like somenthing like "import Numeric as nu", but when I try:
> 
> import_mod Numeric as nu
> 
> I get and error message. Is there any way to fix this?

Yes, there is: use the 'execute' clause instead:

execute import Numeric as nu

will do.

Now that I look back at the whole rc file format, I'm quite embarrassed.  I 
wrote up the recursive config loader code in the first few weeks of learning 
python, and it's just one long, gross, unnecessary hack.  All those special 
cases in the rc files should just go away, and configuring ipython should be a 
simple matter of writing pure python code.  But that rewrite is still in the 
pipeline, so keep using the rc files for now :)

Best,

f




More information about the IPython-user mailing list