From a5680be996defc5d7d1bc05d2d9418bdf80c92cd 2011-01-15 22:19:22 From: Thomas Spura Date: 2011-01-15 22:19:22 Subject: [PATCH] Make ipython.py cProfile-able When using __file__ on startup and cProfile in the same time, __file__ is defined as the __file__ of cProfile and not the local ipython.py. With using sys.argv[0] instead, it's possible to get a cProfile. --- diff --git a/ipython.py b/ipython.py index dd50d01..7c73948 100755 --- a/ipython.py +++ b/ipython.py @@ -9,7 +9,7 @@ somewhere and run ipython.py) and development. """ # Ensure that the imported IPython is the local one, not a system-wide one import os, sys -this_dir = os.path.dirname(os.path.abspath(__file__)) +this_dir = os.path.dirname(sys.argv[0]) sys.path.insert(0, this_dir) # Now proceed with execution