[IPython-user] Does import_some really work?

Fernando Perez fperez.net@gmail....
Fri Mar 23 01:18:04 CDT 2007


Hi Matt,

sorry you never got a reply for this, I just realized how badly I'd
fallen behind on user contributions and requests...

On 6/21/06, Matthew Wilson <matt@overlook.homelinux.net> wrote:
> It's highly possible I'm just using import_some incorrectly.
>
> I want to import a function load_config that exists in this module on
> our file system:
>
> /disk2/ag/common/app/bmm/__init__.py
>
> I have the environmental var $PYTHONPATH set to /disk2/ag/common.
>
> This works fine, in the interpreter, or in programs:
>
> from app.bmm import load_config
>
> In my ipythonrc, I tried this, but apparently the import didn't happen:
>
> import_some app.bmm load_config
>
> I don't see any errors or warnings.
>
> I've resorted to doing this instead:
>
> execute from app.bmm import load_config
>
> And then works perfectly.
>
> What am I doing wrong?

I don't think you are doing anything wrong, it's a buglet in the
import_some implementation.  It is a bug, however, that I'm not going
to fix.  That mechanism was a poorly thought out idea from when I was
just learning python, and as we move towards the new codebase, the
initialization system is going to be completely different (you'll just
use plain python files).  So I'm not going to fix a system that's
slated for removal anyway, especially since in this case the use of
'execute' statements provides a simple workaround.

Regards,

f


More information about the IPython-user mailing list