No such file or directory: '\\uploads\\03.jpeg'

相对路径:加点,或者直接绝对路径(尽量使用绝对路径,通过python的os模块获取当前文件绝对路径)

os.path.dirname(os.path.abspath(__file__))  返回的是文件的目录

os.path.abspath(__file__)返回的是.py文件的绝对路径,包含文件名,并且返回path规范化的绝对路径

相对路径

../表示源文件所在目录的上一级目录,../../表示源文件所在目录的上上级目录,以此类推。
同级目录直接文件名可以直接引用
./下一级目录

来自stackoverflow

Both /tmp and /static/uploads/.., are absolute paths. And your code is looking in the / folder instead of looking in your project's folder. You should use the absolute path to point at your folder /path/to/your/project/static/uploads/.. or use a path relative to the code being executed such as ./static/uploads.

You can also use the following snippet to generate the absolute path:

from os.path import join, dirname, realpath

UPLOADS_PATH = join(dirname(realpath(__file__)), 'static/uploads/..')

flask-----No such file or directory绝对路径与相对路径的更多相关文章

  1. 无后缀名伪静态路径在IIS7.0的网站提示 "404 - File or directory not found"

    新配置服务器(windows server 2008,not sp1) 经测试情况如下: ①无后缀名伪静态路径行在IIS7.0的网站提示 ”404 - File or directory not fo ...

  2. STM32 关于头文件路径没添加错误问题(cannot open source input file "spi.h": No such file or directory)

    error:  #5: cannot open source input file "spi.h": No such file or directory 1.出现这种问题,首先要确 ...

  3. R中读取文件,找不到路径问题 No such file or directory

      R中读取文件,找不到路径问题 No such file or directory 近日,读取文件时.出现例如以下问题 > passenger = read.csv('internationa ...

  4. Git异常:fatal: could not create work tree dir 'XXX': No such file or directory

    GitHub实战系列汇总:http://www.cnblogs.com/dunitian/p/5038719.html ———————————————————————————————————————— ...

  5. Warning: mysql_connect(): No such file or directory 解决方案总结(操作系统: Mac)

    说明: 本文主要内容参考: Mac下PHP连接MySQL报错"No such file or directory"的解决办法, 并进行个人补充 1. 运行环境: Mac OS X 10.11.4 (M ...

  6. error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory

    zabbix3.2启动有如下报错: # service zabbix_server startStarting zabbix_server:  /home/zabbix-server/sbin/zab ...

  7. RHEL 5.7 Yum配置本地源[Errno 2] No such file or directory

    在Red Hat Enterprise Linux Server release 5.7 上配置YUM本地源时,遇到了"Errno 5] OSError: [Errno 2] No such ...

  8. 问题解决:psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

    错误提示: psql: could not connect to server: No such file or directory Is the server running locally and ...

  9. 执行Python "/bin/usr/python: bad interpreter: No such file or directory" 错误

    今天在电脑上写了一个Python脚本,写好之后用ftp传上去,然后执行/var/www/cron.py,结果报错,/bin/usr/python: bad interpreter: No such f ...

随机推荐

  1. Git实用技巧

    1.关于版本控制系统 (1)本地版本控制系统 (2)集中化的版本控制系统 (3)分布式版本控制系统 2.Git的三种状态 对于任何一个文件,在 Git 内都只有三种状态: 已提交(committed) ...

  2. Solr5.5.3的研究之路 ---1、从Mysql导入数据并创建索引

    公司需要用到全文检索,故使用Solr,也是新人一枚,本人查看的前提是Solr已经安装部署成功,我用的服务器是自带的Jetty 1.创建Collection [root@whoami bin]# ./s ...

  3. [Python Study Notes]气泡散点图绘制

    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ...

  4. js闭包(三)

    场景一:采用函数引用方式的setTimeout调用 闭包的一个通常的用法是为一个在某一函数执行前先执行的函数提供参数.例如,在web环境中,一个函数作为setTimeout函数调用的第一个参数,是一种 ...

  5. CSS技巧: CSS隐藏文字的方法(CSS text-indent: -9999px;)

    建站过过程中朋友喜欢把网站名称用H1表示,但从美观考虑,要用logo图片来代替h1,这时需要隐藏h1内的这段文字,但又不能对搜索引擎不友好,否则就失去了定义h1标签的意义. 在CSS中如何以图代字,找 ...

  6. POJ 2176 Folding(区间DP)

    题意:给你一个字符串,请把字符串压缩的尽量短,并且输出最短的方案. 例如:AAAAA可压缩为5(A), NEERCYESYESYESNEERCYESYESYES可压缩为2(NEERC3(YES)). ...

  7. matlab 修改文件夹下所有文件名大写为小写

    1. path = './DIR/';Files = dir(fullfile(path,'*.m'));LengthFiles = length(Files);for count_i = 1 : L ...

  8. Linux 使用静态库注意事项

    1. 静态库一定要放在生成文件后面 gcc main.c -o main libhello.a 2. 使用静态库时一定要连接所有用到的静态库 gcc main.c -o main liba.a lib ...

  9. 硬链接与软链接有什么不同(ln)

    Linux建立的链接有两种方式 如Windows系统下的快捷方式(.lnk)相似的东东 分为硬链接(Hard Link)和软链接(Symbolic Link)也叫符号链接 默认情况下,ln命令产生硬链 ...

  10. JAVA隐藏鼠标的方法

    JAVA隐藏鼠标的方法 2012年06月03日 19:13:21 阅读数:2436 JAVA隐藏鼠标光标,可以有2种方法. 都是通过如下语句重新设置光标 Toolkit.getDefaultToolk ...