[IPython-dev] A couple of odd behaviours...
Thu Nov 8 10:20:37 CST 2012
Thanks again for your time on this Thomas. It's really kind of you to
give the users so much attention, but honestly, focus on your studies
mate. I don't want to think that you fell behind to deal with my
obscure issues :)
On 8 November 2012 16:13, Carl Smith <email@example.com> wrote:
> On reflection, I think I may have caused stdout to go to the terminal
> the one time I saw that it had, by messing around trying to fix
> things. I'm really unsure on that one now. I may have been playing
> with os.system at the time.
> None of this is a massive problem for me as it stands. I'll probably
> want to return the output of all adb shell commands anyway. I've made
> my Android object callable, with it's args being the adb shell
> commands, so I can just do `a = droid('ls')`. It's pure curiosity
> that's got me now.
> On 8 November 2012 16:03, Carl Smith <firstname.lastname@example.org> wrote:
>> I don't have anything in config or startup files at all. I was using
>> nbcloud for ages, and reformatted this machine not so long back, so my
>> local Notebook installation is brand new. I'm still using the default
>> config IPython created for me, and have nothing in startup.
>> I'm not sure how to check ip.system is ip.system_piped, but tried the
>> following with the same result.
>> ip = get_ipython()
>> ip.system = ip.system_piped
>> !adb shell ls
>> I've noticed that it doesn't always print everything to the terminal.
>> It seems to do it sometimes and not others, so I need to figure out
>> what's causing the change and maybe work it out from there.
>> If I do `ip.system = ip.system_raw`, then it always goes to the
>> terminal, so that works. If I do `ip.system = ip.system_piped` it goes
>> bank to printing blank lines, with nothing in the terminal. Because
>> the printing to the terminal thing is happening on and off, well, I've
>> only seen it happen once, I need to find out why. It can't literally
>> be random.
>> I did just try creating a new directory on my main machine, then
>> launching the Notebook from that empty directory, then just running
>> `!adb shell ls` in a new notebook. Same problem. I also tried running
>> the three lines above to explicitly demand that my output gets piped,
>> but to no avail.
>> I tried using os.system, which sends stdout to the terminal, and
>> ip.system, which prints blank lines.
>> P.S. Why does ip.system return None? Shouldn't it return an int?
>> On 8 November 2012 14:23, Thomas Kluyver <email@example.com> wrote:
>>> On 8 November 2012 02:42, Carl Smith <firstname.lastname@example.org> wrote:
>>>> I tried `pwd` and so on, and get the same behaviour. Everything
>>>> printed by `!abd shell <cmd>` ends up in the terminal, not in the
>>>> Notebook, though I still get a newline in the Notebook for each line
>>>> that should be there.
>>>> Any thoughts?
>>> You don't have anything in config or startup files that could be setting
>>> ip.system to ip.system_raw? Can you check that ip.system is ip.system_piped,
>>> just before an offending command?
>>> We fail to redirect C-level stdout from within the kernel process (issue
>>> #1230), but the subprocess when you run a system command should be run in a
>>> new pseudoterminal controlled by IPython, so I'm mystified why the output is
>>> going to the wrong place.
>>> IPython-dev mailing list
More information about the IPython-dev