🖥

#python の IPython で #ruby の binding.pry 的なデバッグがしたいけど 標準入力が奪われてうまく動かなかっ

2019/04/06に公開

sys.stdin.read() が全部と奪ってしまうらしい。
考えてみれば当たり前のような気もするが未言語化。解決策は未調査。

script

#!/usr/bin/env python3

from IPython import embed
import sys

sys.stdin.read()

embed()
a=1

exe

すぐに終了してしまう。

$ echo "abc" | ./debugtest.py
Python 3.7.2 (default, Jan 13 2019, 12:50:01)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.4.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: Do you really want to exit ([y]/n)?

Original by Github issue

https://github.com/YumaInaura/YumaInaura/issues/1096

チャットメンバー募集

何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。

https://line.me/ti/g2/eEPltQ6Tzh3pYAZV8JXKZqc7PJ6L0rpm573dcQ

Twitter

https://twitter.com/YumaInaura

公開日時

2019-04-06

Discussion