【发布时间】:2016-10-09 16:38:14
【问题描述】:
我不熟悉 shell,但我必须从 Python 文件运行此命令:
curl -XDELETE 'localhost:9200/event/_query?pretty' -d '{"query" : { "range" : { "int_timestamp" : { "lte" : "2016-06-09 08:55:10" } } } }'
从文件中我使用 os.popen 来执行命令。我也用 os.system 尝试过。在这两种情况下,它都会给我以下错误:
(23) Failed writing body
但是当我在 shell 中运行这个命令时,它运行良好。
我做错了什么? 感谢帮助!
编辑: 我不知道为什么,因为我没有改变什么。但现在它可以使用 os.system 而不是 os.popen。
无论如何感谢您的帮助!
【问题讨论】:
-
你能告诉我们你的python尝试吗?无论如何,您在这里有关于错误的很好信息stackoverflow.com/questions/16703647/…
-
在我的python文件中我使用这个命令:
os.popen('curl -XDELETE \'localhost:9200/event/_query?pretty\' -d \'{"query" : { "range" : { "int_timestamp" : { "lte" : "'+stdate+'" } } } }\'')
标签: python shell python-3.x curl