写入tmp / data.json时权限被拒绝

时间:2019-07-17 15:57:47

标签: python json windows flask permissions

我正在运行本地烧瓶服务器,并尝试将数据写入.json文件,但收到错误消息:

[Errno 13]权限被拒绝:“ tmp / data.json”

我正在Windows 10机器上运行它,因此无法使用chmod更改文件的权限。我用过:

icacls data.json / grant每个人:F

但我仍然收到相同的错误消息。

我用于写入文件的代码是:

with open('tmp/data.json', 'w+') as f:
    json.dump(raw, f)

该文件将写入用户发布的表单中的数据

@app.route('/result/', methods=['POST'])
def result():
    if request.method == 'POST':
        result = request.form
        # formatting code from the request to a json object then write to file

我正在使用具有管理员权限的cmd.exe通过命令 flask run 运行烧瓶服务器

0 个答案:

没有答案
相关问题