Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/280.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/react-native/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Git通过subprocess.call使用时抑制其他打印语句的输出_Python_Git_Subprocess - Fatal编程技术网

Python Git通过subprocess.call使用时抑制其他打印语句的输出

Python Git通过subprocess.call使用时抑制其他打印语句的输出,python,git,subprocess,Python,Git,Subprocess,在脚本中,我正在进行git提交 def test(): ...: subprocess.call(['git','--no-pager','commit','-m',"no pager test"]) ...: print "hello" 我在网上读到关于无寻呼机的内容后,添加了无寻呼机选项,但没有任何帮助。在运行测试时,您可以看到hello不会被打印。Git不会抑制任何内容。由于某种原因,它不会返回,但subprocess.call会等待它完成。如果您要杀死等待

在脚本中,我正在进行git提交

 def test():
   ...:     subprocess.call(['git','--no-pager','commit','-m',"no pager test"])
   ...:     print "hello"

我在网上读到关于无寻呼机的内容后,添加了无寻呼机选项,但没有任何帮助。在运行测试时,您可以看到hello不会被打印。

Git不会抑制任何内容。由于某种原因,它不会返回,但subprocess.call会等待它完成。如果您要杀死等待的子进程,则将执行打印。您可能希望查看子进程,而不是自己处理子进程。我使用的是git版本1.8.3.2和Python 2.7.5,它适合我。。。事实上,它也可以在没有-无寻呼机选项的情况下工作。你能告诉我你有哪些python和git版本吗?@mu無 git版本1.9.1,Python 2.7.6