赞
踩
- import os
- from flask import Flask, request, jsonify
-
- app = Flask(__name__)
-
- @app.route('/run_exe', methods=['POST'])
- def run_exe():
- # 获取请求参数
- exe_path = request.json['exe_path']
- input_file = request.json['input_file']
- output_file = request.json['output_file']
-
- # 拼接命令行参数
- cmd = f'{exe_path} {input_file} {output_file}'
-
- # 调用本地 exe 文件
- os.system(cmd)
-
- # 返回结果
- return jsonify({'msg': 'success'})
-
- if __name__ == '__main__':
- app.run(debug=True)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。