我正在尝试查看一个子目录以获取App Engine中的所有unicode文件名,但它反而给了我这个。但是,当子目录填充非unicode文件名时,它可以工作。
Traceback (most recent call last):
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1535, in __call__
rv = self.handle_exception(request, response, e)
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1529, in __call__
rv = self.router.dispatch(request, response)
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1278, in default_dispatcher
return route.handler_adapter(request, response)
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1102, in __call__
return handler.dispatch()
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 572, in dispatch
return self.handle_exception(e, self.app.debug)
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 570, in dispatch
return method(*args, **kwargs)
File "/base/data/home/apps/s~theonlyrt6/1.372787192964623739/main.py", line 69, in get
'titles' : os.listdir("./Articles")
OSError: [Errno 2] No such file or directory: './Articles'
这是我的代码:
template_values = {
'titles' : os.listdir("./Articles")
}
template = jinja_environment.get_template('HTML/Articles.html')
self.response.write(template.render(template_values))
子目录不会作为静态目录上传,并且在本地运行时可以正常工作。
谢谢!