FileNotFoundError: [Errno 2] No such file or directory的解决方法

时间:2018-10-31 15:41:20   收藏:0   阅读:7573

 

1.获取当前文件所在路径

basedir = os.path.dirname(__file__)
print("basedir:" + basedir)

2.将路径进行拼接
upload_path = os.path.join(basedir, "static/upload", filename)

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!