I started learning web.py by following the Udemy tutorial by Joseph Delgadillo. I've tried to render a template and run the code, but constantly get this error and i don't know why. The error always says that there is a syntax error on line 6 no matter how much i change the spacing and other stuff.
invalid syntax
Template traceback:
File 'D:\Projects\python_proj\PythonNew\learning\webstuff\webpy\resources\main.html', line 6
None (main.html, line 6)
Here's the python code
import web
urls = (
"/(.*)/(.*)", "index"
)
render = web.template.render("D:\Projects\python_proj\PythonNew\learning\webstuff\webpy\resources\")
app = web.application(urls, globals())
class index:
def GET(self, name, age):
return render.main(name, age)
if __name__ == "__main__":
app.run()
For the file path, I found out that i must define the whole file path or I would get an error saying that the template doesn't exist.
Here's the html main.html
$def with (name, age)
<h1>Name: $name</h1>
<p>Your current age is $age</p>
I searched all over StackOverflow, but couldn't find a single answer, even though there where questions like mine. Also sorry if the code snipets don't turn out like they should be, I'm new to stackoverflow.
question from:
https://stackoverflow.com/questions/66067798/web-py-invalid-syntax-template-traceback 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…