ツールチェーンを Eclipse ベースの python ide から vim ベースの同等のものに切り替えています。
私は現在pudbを試しています。
Google が tensorflow の例として提供するコードをステップ実行しようとしています。これは、python3.5 の venv で実行されます。どのデバッガーも venv 固有のライブラリをインポートする際に問題を引き起こさないため、それらはすべて目的の venv で動作していると思います。
pdb と ipdb は両方とも、問題なくコード全体を実行/ステップスルーします。これは素晴らしいことです。
pudb を実行しようとすると、次のエラーが表示されます。
Traceback (most recent call last):
File "~/interpreters/p35/lib/python3.5/site-packages/tensorflow/python/platform/app.py",
line 44, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough)) TypeError: main() takes 0 positional arguments but 1 was given
メインは次のように定義されます。
def main(argv=None): # pylint: disable=unused-argument
cifar10.maybe_download_and_extract()
if tf.gfile.Exists(FLAGS.train_dir):
tf.gfile.DeleteRecursively(FLAGS.train_dir)
tf.gfile.MakeDirs(FLAGS.train_dir)
train()
if __name__ == '__main__': tf.app.run()
そして tf.app.run() は次のようになります:
def run(main=None, argv=None):
#Runs the program with an optional 'main' function and 'argv' list.
f = flags.FLAGS
# Extract the args from the optional `argv` list.
args = argv[1:] if argv else None
# Parse the known flags from that list, or from the command line otherwise.
# pylint: disable=protected-access
flags_passthrough = f._parse_flags(args=args)
# pylint: enable=protected-access
main = main or _sys.modules['__main__'].main
# Call the main function, passing through any arguments to the final program.
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
インターフェイスが本当に好きなので、このコードで pudb を動作させることを本当に望んでいました。
私はここで多くのオプションをいじくり回し、不足しています。ここでのpdb、ipdb、およびpudb間の動作の違いについて何か考えがある人はいますか?
ありがとう、
nt