为什么运行Python代码时vim不在控制台中打印任何内容?

2024-06-26 13:51:26 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图用tornado编写一些python代码。这是我的密码。在

import sys
import tornado.ioloop
import tornado.web
import constants

class student():
    name = ""

class MainHandler(tornado.web.RequestHandler):
    def get(self):
        loader = tornado.template.Loader(".")
        print "MainiiiHandler"
        self.write(loader.load("base.html").generate(pics=constants.pics))

application = tornado.web.Application([
    (r"/", MainHandler),
])

if __name__ == "__main__":
    application.listen(8888)
    tornado.ioloop.IOLoop.instance().start()

所以当我访问127.0.0.1:8888时,它应该在终端中打印MainiiiHandler。当我用“python”运行python代码时测试.py'事实上是这样的。但是当我在vim中运行:make时,它不会打印MainiiiHandler。因为我非常喜欢vim中的make函数,所以你能帮我解决这个问题吗。在


Tags: 代码nameimportselfwebapplicationloadervim
1条回答
网友
1楼 · 发布于 2024-06-26 13:51:26

如何检查

makeprg is python %

是书面的。在

:set makeprg="python %"

对我不起作用(回响一个空字符串) 同时

^{pr2}$

确实有效。在

(如果没有帮助的话)这就是:h制作节目:

The program given with the 'makeprg' option is started (default "make") with the optional [arguments] and the output is saved in the errorfile (for Unix it is also echoed on the screen).

如果您的系统不是Unix,我想您必须提供代码来打印errorfile的内容(不确定,因为我只在Linux下测试过它)。在

相关问题 更多 >