win10安装python失败 找不到指定的路径_Python:FileNotFoundError:[WinError 3]系统找不到指定的路径:...

我想弄清楚为什么我的输出会提前结束,当我把目录从我的硬盘驱动器到一个网站。我删除了调试模式的错误消息并得到以下错误:FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:\\Users\\Huang.LabTech2\\Desktop\\Images\\2017 Data\\Air Tractor 402/Air Tractor 402/5-10-2017/IR Filter'

我不知道它为什么在运行时寻找第二个Air Tractor 402文件夹,但其他文件夹也会出现这种情况:

^{pr2}$

我的代码:from flask import Flask, abort, send_file, render_template, render_template_string

import os

import remoteSensingData

app = Flask(__name__)

@app.route('/', defaults={'req_path': ''})

@app.route('/')

def dir_listing(req_path):

BASE_DIR = os.path.abspath(r'C:/Users/Huang.LabTech2/Desktop/Images/2017 Data/')

# Joining the base and the requested path

abs_path = os.path.join("c:", BASE_DIR, req_path)

# Return 404 if path doesn't exist

# if not os.path.exists(abs_path):

# return render_template('404.html'), 404

# Check if path is a file and serve

# if os.path.isfile(abs_path):

# return send_file(abs_path)

# Show directory contents

files = os.listdir(abs_path)

files = [os.path.join(req_path, file) for file in files]

# return render_template('files.html', files=files)

return render_template_string("""

{% for file in files %}

{{ file }}

{% endfor %}

""", files=files)

if __name__ == '__main__':

app.run(debug=True)

你可能感兴趣的:(win10安装python失败,找不到指定的路径)