简体   繁体   English

在Spyder中调试Python脚本(带有标志)

[英]Debugging a Python Script (With Flags) in Spyder

Forgive me, I'm coming from a MATALB background, and I'm still a litte confused at how the Python "modules" all work together. 请原谅我,我从MATALB背景的,我仍然在如何Python的“模块”的所有作品混淆豆蔻在一起。

I installed Anaconda, and I'm using the Spyder IDE with the default IPython console (I think I said that all right). 我安装了Anaconda,并且将Spyder IDE与默认的IPython控制台一起使用(我想我说的没问题)。 I'm going through the Google Education lessons, and I'm presented with the challenge of calling a particular code like so: 我正在学习Google教育课程,并且遇到了这样调用特定代码的挑战:

./wordcount.py {--count | --topcount} file

I figured out (thanks to this thread ) that I could run this from IPython within Spyder: 我发现(由于有了这个线程 )我可以在Spyder中从IPython运行它:

%run wordcount.py --count alice.txt

The problem that I'm having is that when I call wordcount.py in this way from the console, it disregards any of the breakpoints I have set and I need to line-by-line step through my code. 我遇到的问题是,当我从控制台以这种方式调用wordcount.py时,它忽略了我设置的任何断点,并且需要逐行逐步检查代码。 Alternatively, if I try to run the dubugger that's part of Spyder, I can't seem to specify any of those flag command line arguments. 另外,如果我尝试运行Spyder的dubugger,则似乎无法指定任何这些标志命令行参数。

What am I missing? 我想念什么? Thanks! 谢谢!

The secret is to modify the Run Settings ! 秘诀就是修改运行设置 Under the Run Settings > General Settings you're given the chance to run command line options. 在“运行设置”>“常规设置”下,您可以运行命令行选项。 The debugger observes these additional command line options when run. 调试器在运行时会遵守这些其他命令行选项。

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM