[IPython-user] OS X: symbolic links, module paths, logging module

Jussi Rasinmäki jussi.rasinmaki@simosol...
Tue May 13 05:31:02 CDT 2008


>  >  1) I use symbolic links as shortcuts to my script from data
>  >  folders on Mac. First I %ran the script from IPython from the first
>  >  data folder, then decided to switch to a different folder (and delete
>  >  the symbolic link in the first folder), %cd to the other one and again
>  >  %run the script. The script has a bug, and the Traceback's filepath
>  >  for the script is  the one for the first run using the already deleted
>  >  symbolic link.
>  >  I guess this is the reason why I don't seem to be able to set breakpoints
>  >  for the module in pdb. This persists even after restarting ipython.
>  >  How do I fix this?
>
>  I have no clue at this point. Certainly restarting ipython should fix this...

This may actually have something to do with the fact that my Python
environment was something of a mess (Apple, python.org & Fink). I've
cleaned things up a little and am now running .org 2.5.2 and IPython
0.8.3.svn.r3001. There is still one problem though which might be
related to the one above:
Modifying the source externally using Textmate => %run =>
modifications aren't picked up by IPython & a new pyc isn't created
even if I remove the pyc manually (sometimes, sometimes removing pyc
works). The traceback does show the modified code though. Restarting
does fix this.

>  >  2) The script uses the logging module to log messages. The
>  >  successive %runs within IPython result in multiple console log
>  >  messages. On the second run each message shows up twice on the screen,
>  >  on the third run three time etc. Fix for this?
>
>  Ty reload(logging). You probably set up multiple loggers in the
>  logging module global space, and the old ones don't disappear between
>  %run:s.

Spot on, thanks!

Jussi

>  --
>  Ville M. Vainio - vivainio.googlepages.com
>  blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio'
>


More information about the IPython-user mailing list