【问题标题】:Python Invoke and console output issuePython调用和控制台输出问题
【发布时间】:2015-04-11 12:49:48
【问题描述】:

我正在使用Invoke 执行任务。问题是,它隐藏了大部分控制台输出。因此,我看不到我的应用程序的输出。

我有一个运行 shell 的任务。 Invoke 更改默认 shell 的行为。 Back key 不起作用。

如何从控制台获取大部分输出? 还有什么是执行 shell 的更好方法,以便 shell 具有它应该具有的所有功能?

更新

以下是我tasks.py的内容

from invoke import task, run

@task
def serve():
    run("python manage.py runserver")

@task
def test():
    run("python manage.py test")

@task
def shell():
    run("python manage.py shell")

【问题讨论】:

  • @huazhihao 我已经更新了问题:)
  • 我猜你使用的是Windows?我在 Windows 上遇到了同样的问题,在 Ubuntu 上这工作正常。
  • @KarolisŠarapnickis 不,我使用的是 Mint 15,你知道 Ubuntu 的变种。

标签: python invoke pyinvoke


【解决方案1】:

pty=True 传递给run 可以解决问题。

【讨论】:

    【解决方案2】:

    就我而言,我尝试使用 --pty (-p) 标志和 --debug (-d) 标志:

    invoke -pd task-name

    【讨论】:

      猜你喜欢
      • 2019-08-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-05-26
      • 2011-05-21
      • 1970-01-01
      • 2020-07-24
      • 2021-06-29
      相关资源
      最近更新 更多