简体   繁体   English

调试睡衣python代码

[英]Debugging pyjamas python code

I am using pyjamas to develop a web page. 我正在使用睡衣来开发网页。 I write python code which is translated to javascript by pyjamas. 我编写python代码,由睡衣翻译为javascript。 This way debugging programming error is caught only when testing the web page. 这样,只有在测试网页时才会捕获调试编程错误。 It would be much more efficient if we can run the code first in the Python interpreter before compiling to javascript. 如果我们可以在编译为javascript之前首先在Python解释器中运行代码,效率会更高。 This seems would require pyjamas-desktop be installed. 这似乎需要安装睡衣 - 桌面。 I tried installing pyjamas-desktop but it was not straight forward for me and I could not succeed in installing pyjamas-desktop. 我尝试安装睡衣 - 桌面,但对我来说并不简单,我无法成功安装睡衣 - 桌面。

I am wondering if there is anyway to run the code to just check for errors ie I do not want to see the widgets popped up. 我想知道是否有任何方式运行代码只是检查错误,即我不想看到弹出窗口小部件。 But just running in the interpreter so that errors like missing to import a module that is used in the program are caught. 但只是在解释器中运行,以便捕获导入程序中使用的模块时丢失的错误。

Pylint is probably the first place to start - it can be installed with easy_install then run as Pylint可能是第一个开始的地方 - 它可以用easy_install安装然后运行

$ pylint my_python.py

The verbosity of errors can be easily edited - but any major problems will be highlighted immediately - and you don't need those extra pyjamas-desktop modules installed! 可以轻松编辑错误的详细程度 - 但任何重大问题都会立即突出显示 - 而且您不需要安装那些额外的睡衣 - 桌面模块! Other similar tools (that do the same sort of thing) are PyCheckMate (syntax check only), PyChecker, and PyFlakes. 其他类似的工具(做同样的事情)是PyCheckMate(仅限语法检查),PyChecker和PyFlakes。

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

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