Skip to content

Using ExcelPython with iPython #37

@dvincentwest

Description

@dvincentwest

A few users have mentioned the desire to have modules auto-reload, which certainly would be nice when developing calculations and other things to go along with that. It occurred to me that we should just be able to use ipython, instead of pythonw, and have things interface that way, and then use a special excel-python profile to activate the autoreload module for ipython.

first I created an ipython profile by running,
ipython profile create excelpython

Then in the ipython_profile.cfg file in the newly created profile_excelpython folder, I put the two lines:

c.InteractiveShellApp.extensions = ['autoreload']
c.InteractiveShellApp.exec_lines = ['%autoreload 2']

using this profile in a command line works as expected, auto-reloading modules on the fly.

Then I went into the excelpython config file and I changed line 25 of the xlpython.cfg file from:
Command = pythonw.exe -u "$(ConfigDir)\xlpyserver.py" $(CLSID)
to
Command = ipython.exe --profile=excelpython "$(ConfigDir)\xlpyserver.py" $(CLSID)

It launches correctly, and will do python calculations as expected (at least in simple cases), although now it pops up a persistent window for the python runtime.

However, the auto-reload feature is not working as expected, and modules are not re-loading as they do when working in one of the standard ipython interfaces.

Is there an intrinsic reason this won't work, or maybe this is just a setting or a small change somewhere?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions