当我从Kibana下载数据时, 首先我编写索引json文件,然后运行bat文件下载数据。 这是python代码:
import subprocess
def RunBat(path,OutFileName):
filepath=path + OutFileName + ".bat"
p = subprocess.Popen(filepath, shell=False, stdout = subprocess.PIPE)
stdout, stderr = p.communicate()
#subprocess.check_call([path + 'curl.exe', filepath], shell=True)
return p.returncode # is 0 if success
path = "H:/lhy/20170710/test/"
OutFileName = "2017072100_0"
RunBat(path,OutFileName)
返回错误:
Traceback (most recent call last):
File "<ipython-input-14-d979ed3f5955>", line 12, in <module>
RunBat(path,OutFileName)
File "<ipython-input-14-d979ed3f5955>", line 3, in RunBat
p = subprocess.Popen(filepath, shell=False, stdout = subprocess.PIPE)
File "d:\Users\DT217\Anaconda3\lib\subprocess.py", line 707, in __init__
restore_signals, start_new_session)
File "d:\Users\DT217\Anaconda3\lib\subprocess.py", line 990, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2]
bat文件是:
curl -u username:password -H "Content-Type: application/json" --data @./2017072100_0.json -XGET "http://support.derbysoft.com/elasticsearch/derbysoft-marriott-20170721/_search" > marriottadapter2017072100_0_result.json
我只需单击.bat文件,就可以了。 谢谢。