问题描述
我已经看到一些与文件和文件相关的问题。使用Python和GAE创建新目录,但是其中一些人总结(不仅仅是在SO上),认为Python 不能写入文件或创建新的目录。但是这些命令存在,大量的其他人似乎正在写文件和打开目录没有问题。
I have seen a number of questions relating to writing files & creating new directories using Python and GAE, but a number of them conclude (not only on SO) by saying that Python cannot write files or create new directories. Yet these commands exist and plenty of other people seem to be writing files and opening directories no problem.
我正在尝试写入.txt文件并创建文件夹并获取以下错误:
I'm trying to write to .txt files and create folders and getting the following errors:
案例#1:
with open("aardvark.txt", "a") as myfile:
myfile.write("i can't believe its not butter")
产生IOError:[Errno 30]只读文件系统:'aardvark.txt'。但是我已经检查过,它不是一个只读文件。
produces "IOError: [Errno 30] Read-only file system: 'aardvark.txt'". But i've checked and it's def-o not a read only file.
案例#2:
folder = r'C:\project\folder\' + str(name)
os.makedirs(folder)
产生OSError:[Errno 38]功能未实现:'C:\project\folder'
produces "OSError: [Errno 38] Function not implemented: 'C:\project\folder'"
我缺少什么?
推荐答案
Appengine不支持对文件系统进行任何写操作(除其他限制之外)。
BlobStore确实有像api这样的文件,但是你不能重写/追加到现有的blob存储实体。开发者服务器还提供了这些限制来模拟生产环境。
Appengine does not support any write operations to the filesystem (amongst other restrictions).The BlobStore does have a file like api, but you cannot rewrite/append to existing blob store entities. The dev server also presents these restrictions to emulate production environment.
您应该阅读有关appengine的一些文档。
概述文档明确指出你不能写。
You should probably have a read of the some of the docs about appengine.The overview doc https://developers.google.com/appengine/docs/python/overview explicitly states you can't write.
这篇关于makedirs错误:GAE可以创建新目录(文件夹)吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!