3

I had set up a startup.py script for python that imported the commonly used modules like re, os and sys. Ipython however does not seem to run it at startup because trying to use one of the modules raises an error.

Plakhoy
  • 1,846
  • 1
  • 18
  • 30
  • 3
    Create an `ipython_config.py` file by running `ipython profile create`. Then search in that for `exec_files` and add your startup file to the list. – Thomas K Apr 14 '13 at 15:33
  • 1
    You question would get more attention if you actually *asked* a question instead of just presenting some facts. – shx2 Apr 15 '13 at 04:55
  • thanks @ThomasK , your solution worked. I found minrk's answer to be a bit too much work. – Plakhoy Jul 17 '13 at 04:47
  • To be honest, Min's solution is probably easier. IPython will run any scripts in .ipython/startup/ – Thomas K Jul 17 '13 at 16:15

1 Answers1

5

if you drop your startup.py into the directory found at $(ipython locate profile)/startup/, then it will run on every IPython startup (you may need to create the startup directory first).

minrk
  • 37,545
  • 9
  • 92
  • 87