简体   繁体   English

无法使用 python flask 写入文件

[英]Can't write on file with python flask

I'm trying to write on a file with flask, with some information that I receive on a website.我正在尝试使用 flask 写入文件,其中包含我在网站上收到的一些信息。 However, it gives me the 500 error on the specific line when I'm trying to open a file to be writable.但是,当我尝试打开可写文件时,它会在特定行上出现 500 错误。 I've tried opening it from a variety of ways like this:我尝试过通过以下多种方式打开它:

with open('scooters.csv','w') as csv_file:

and like this:像这样:

csv_file = open('scooters.csv','w')

And both of these give the 500 error这两个都给出了 500 错误

I can open it with:我可以打开它:

csv_file = open('scooters.csv')

But then, when I want to write with:但是,当我想写:

csv_file.writerow(row)

It gives me the 500 error again它再次给了我 500 错误

Can somebody help me?有人可以帮助我吗?

Check the user running the python process.检查运行 python 进程的用户

I see relative pathnames.我看到相对路径名。 Are you sure that user can write to the full pathname?您确定该用户可以写入完整路径名吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM