所以我从用户那里获取了3个输入,都是文件路径,然后将它们输入到一个函数中,这个函数可以正常工作。但我每次都会犯上面提到的错误,我哪里出了错
app = Flask(__name__)
@app.route('/info', methods = ["POST", "GET"])
def infotaking():
if request.method == "POST":
dp1 = request.form["dp"]
mf1 = request.form["mf"]
tess1 = request.form["tess"]
#return redirect(url_for("user", pdflocation=dp))
return redirect(url_for("aadharmask", pdflocation=dp1, masklocation=mf1, tessLocation=tess1))
else:
return render_template("infotaking.html")
@app.route('/masking')
def aadharmask(pdflocation, masklocation,tessLocation):
正在使用infotaking.html获取dp、mf和tess
{% block title %} Input file paths {% endblock %}
{% block content %}
<form action = "#" method = "POST">
<p>datapath:</p>
<p><input type ="text" name ="dp" /></p>
<p>masked files saving path:</p>
<p><input type ="text" name ="mf" /></p>
<p>tesseract ocr location</p>
<p><input type ="text" name ="tess" /></p>
<p><input type ="submit" value ="submit" /></p>
</form>
{% endblock %}
编辑 使用@Parzival的解决方案后,会弹出一个新的错误,路径被读取错误,即它们应该是什么
他们是什么
pdflocation:D
masklocation:dataset
tesseract位置:pdf/D:/dataset/maskedD:/tesseract/tesseract.exe
尝试:
如有必要,还可以指定数据类型:
问题来自第二个应用程序路由,您没有指定如何生成用于屏蔽的URL
函数
aadharmask
需要url提供三个参数(pdflocation、masklocation、tessLocation),但没有提供任何参数。您需要指定如何使用给定参数创建URL-除非指定,否则flask无法为具有参数的函数生成URL。 See Flask documentation编辑
似乎参数中有
/
字符,flask将其解释为另一条路由尝试使用在URL中指定
path
类型,例如:新选项
尝试:
相关问题 更多 >
编程相关推荐