【发布时间】:2014-01-25 22:25:06
【问题描述】:
我打算制作文件管理系统,但奇怪的问题是,当我应用返回目录内容的函数时,它会引发错误!
这是我返回目录内容的函数(在我的机器上 100% 工作)
def GET_Contents(filepath):
os.chdir("files")
os.chdir(filepath)
contents=os.listdir(os.getcwd())
return contents
这里是来自文件管理系统的代码
@route("/TofePanel/FileManager/<filepath:path>")
def FileMamager(filepath):
if request.get_cookie("__auth",secret="xxxxxxxx") is "xxxxxxxx":
cont=GET_Contents(filepath)#just calling the function and ignore result
return template("static/templates/TCP/FileMgr",PATH=filepath)
else:
redirect("/TofePanel/Login")
它会引发一个错误,上面写着:Template 'static/templates/TCP/FileMgr' not found.
但是当我评论 cont=GET_Contents(filepath)#just calling the function and ignore result 时,它工作正常!
【问题讨论】:
标签: python python-2.7 template-engine bottle