[IPython-user] Embedding IPython with py2exe
mike at pcblokes.com
Fri Dec 31 15:18:42 CST 2004
Fernando Perez wrote:
> Michael Foord wrote:
>> which is called with :
> Just as a minor side note, you could set localvars=None by default,
> and fetch them for the user using sys._getframe. See how the
> IPShellEmbed's __call__ method works for details. It's just a small,
> nice convenience for your users, so they can just say:
> and be done with it. If the computer can figure out a sensible
> default, by all means let it do it :)
Thanks for your advice - I'll add make the change for the next update.
>> Nice and easy !! Except when called from a py2exe program, site.py isn't
>> imported. This means that 'copyright' and 'credits' aren't available as
>> builtins. This causes part of IPython to fail. To rectify this I used
>> the following code straight from site.py :
>> This solves the problem neatly. I've also posted this message to the
>> py2exe mailing list as well. It could also be fixed by testing for
>> NameError when they are used in IPython... but that may not be a
> Well, I'm not exactly sure what your question is here. Would you
> prefer ipython to perform this kind of check, or are you happy with
> your current solution? I don't have a problem with adding such a
> check, esp. because other embedded users may run into the exact same
> problem down the road. I tend to avoid too many special-purpose
> checks, but this one seems to provide wide benefit, and as I'm
> starting to work on the internal cleanup for GUI embedding, this may
> well become necessary.
Both. I'm quite happy with my current fix. *But* for the sake of others
who may want to embed IPython and use py2exe it would be wise to fix it
so this is generally possible.
By the way - although there are no prebuilt environments for download
yet, 'Movable Python' is already available. The source code that builds
the environments (configurable) with docs, is available from :
The online docs are at :
(Sorry - can't resist the chance to advertise !!)
> ps. Good luck with your project, and thanks for including ipython!
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.298 / Virus Database: 265.6.7 - Release Date: 30/12/04
More information about the IPython-user