[IPython-User] using %run confuses stderr (makes it to post everything twice, 3, 4, 5 times..)

Ilia Chinkarev ilia.chinkarev@gmail....
Tue Feb 4 23:53:46 CST 2014


What if I do something like:

import sys
import IPython.kernel.zmq.iostream as myStream

myStdErr = myStream.OutStream(session = sys.stderr.session, pub_socket =
sys.stderr.pub_socket, name = sys.stderr.name)
sys.stderr = myStdErr

every time I run it again?

What will happen with the stderr that I am replacing? Will it potentially
create memory leaks? Do I have to .close() it?


On Tue, Feb 4, 2014 at 5:57 PM, MinRK <benjaminrk@gmail.com> wrote:

> Are you using logging? If so, it's easy to accidentally connect new
> handlers on each run, which will duplicate output (and logging goes to
> stderr by default).
>
> -MinRK
>
>
> On Tue, Feb 4, 2014 at 4:53 PM, Ilia Chinkarev <ilia.chinkarev@gmail.com>wrote:
>
>> Dear all,
>>
>> When I am using %run to run my scripts, I see a rather weird phenomena:
>>
>> When I run it for the first time - everything works as expected.
>>
>>  When I run it more than 1 time, the stderr output (the red/pink one) is
>> starting to duplicate itself. It's much easier to post a screenshot, than
>> to explain, so please see the attached screenshot.
>>
>>  But in words, it's like this: Every line would repeat itself next time
>> I run it. So this:
>>
>>
>> no configs found; falling back on auto-configuration
>> no configs found; falling back on auto-configuration
>>
>>
>> creating tmp directory c:\users\ilia\appdata\local\temp\MrJobTest.ilia.20140205.004723.604000
>>
>>
>> writing to c:\users\ilia\appdata\local\temp\MrJobTest.ilia.20140205.004723.604000\step-0-mapper_part-00000
>>
>>
>> Would become this:
>>
>>
>>
>> no configs found; falling back on auto-configuration
>> no configs found; falling back on auto-configuration
>>
>>
>> no configs found; falling back on auto-configuration
>> no configs found; falling back on auto-configuration
>>
>>
>> creating tmp directory c:\users\ilia\appdata\local\temp\MrJobTest.ilia.20140205.004723.604000
>>
>>
>> creating tmp directory c:\users\ilia\appdata\local\temp\MrJobTest.ilia.20140205.004723.604000
>>
>>
>> writing to c:\users\ilia\appdata\local\temp\MrJobTest.ilia.20140205.004723.604000\step-0-mapper_part-00000
>>
>>
>> writing to c:\users\ilia\appdata\local\temp\MrJobTest.ilia.20140205.004723.604000\step-0-mapper_part-00000
>>
>>
>>
>> Even if this is a bug, I was wondering is there any way to avoid it or to shortcut it, except shutting down the kernel and starting it again. It works, but it's very tedious.
>>
>>
>> Thank you all very much in advance.
>>
>>
>> _______________________________________________
>> IPython-User mailing list
>> IPython-User@scipy.org
>> http://mail.scipy.org/mailman/listinfo/ipython-user
>>
>>
>
> _______________________________________________
> IPython-User mailing list
> IPython-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-user
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-user/attachments/20140204/e8187c0f/attachment-0001.html 


More information about the IPython-User mailing list