[IPython-dev] %install_ext question

Greg Novak greg.novak at gmail.com
Tue Apr 9 12:43:40 EDT 2013


Sorry for the delay in responding to this.

If I just put the zip file in a directory on sys.path, I can't import it.
 I tried it both where the zip file contained the leading directory (so
grasp/grasp.py and grasp/__init__.py) and also where the zip file just
contained grasp.py and __init__.py at the top level.

But if I put the zip file itself on the path via sys.path +=
['blah/blah/grasp.zip'] then I can import grasp using either of the two zip
file structures above.

Greg



On Wed, Apr 3, 2013 at 2:36 PM, Thomas Kluyver <takowl at gmail.com> wrote:

> On 3 April 2013 13:12, Greg Novak <greg.novak at gmail.com> wrote:
>
>> It does indeed put the file into .ipython/extensions, but then to use it
>> I need to put the zip file in sys.path explicitly.  Just having the zip
>> file in the extensions directory isn't enough.  So if I also do:
>>
>> import sys
>> sys.path += ["/Users/novak/.ipython/extensions/grasp.zip"]
>>
>
> Is the zip file itself importable? i.e. if you put the directory
> containing the zip file on your PYTHONPATH, can you do 'import grasp'? I
> think it needs to be structured so that the top level of the zip file
> contains an __init__.py file.
>
> But it's fine to install using pip instead - it's a deliberate feature
> that an extension is simply any importable module with a
> load_ipython_extension() function at the top level. Sympy, for example,
> includes an IPython extension as part of its installation.
>
> Thomas
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20130409/b0ae22b8/attachment.html>


More information about the IPython-dev mailing list