I am new to flask and started following this video tutorial... I completed it yesterday and came back to it today wherein, the EXACT SAME code which worked nicely till then, started displaying the following error:
Traceback (most recent call last):
File "app.py", line 5, in <module>
app = Flask(__name__)
File "C:\Users\VS\AppData\Local\Programs\Python\Python38-32\lib\site-packages\flask\app.py", line 558, in __init__
self.add_url_rule(
File "C:\Users\VS\AppData\Local\Programs\Python\Python38-32\lib\site-packages\flask\app.py", line 66, in wrapper_func
return f(self, *args, **kwargs)
File "C:\Users\VS\AppData\Local\Programs\Python\Python38-32\lib\site-packages\flask\app.py", line 1216, in add_url_rule
self.url_map.add(rule)
File "C:\Users\VS\AppData\Local\Programs\Python\Python38-32\lib\site-packages\werkzeug\routing.py", line 1562, in add
rule.bind(self)
File "C:\Users\VS\AppData\Local\Programs\Python\Python38-32\lib\site-packages\werkzeug\routing.py", line 711, in bind
self.compile()
File "C:\Users\VS\AppData\Local\Programs\Python\Python38-32\lib\site-packages\werkzeug\routing.py", line 767, in compile
self._build = self._compile_builder(False)
File "C:\Users\VS\AppData\Local\Programs\Python\Python38-32\lib\site-packages\werkzeug\routing.py", line 1128, in _compile_builder
return self.BuilderCompiler(self).compile(append_unknown)
File "C:\Users\VS\AppData\Local\Programs\Python\Python38-32\lib\site-packages\werkzeug\routing.py", line 1119, in compile
co = types.CodeType(*code_args)
TypeError: code() takes at least 14 arguments (13 given)
P.S.:Source code is in the video description... Thanks in advance:)
I was having the same issue with a course im about to start that uses the versions of Flask 1.0.2, Werkzeug 0.15.2 and he is also using Python 3.7.3.
Most answers were pointing towards some error in the werkzeug version, so I decided to uninstall everything and use the most recent stuff... and it worked out. Now im using flask 1.1.2 and Werkzeug 1.0.1.
Hopefully it might help you, if you still need.
If you're not tied to a specific version of Flask or Werkzeug, as per your requirements.txt and happy to run the latest versions, then you can run the following command to upgrade both libraries.
pip install --upgrade werkzeug
pip install --upgrade flask
If you have to stick with a specific version of Flask (or Werkzeug), you can use the following command to install that version
e.g. pip install --no-cache-dir -I flask==1.0.2
If for whatever reason, the above doesn't install a working Werkzeug as well, then you can run this command/hack below to see what versions are available for Werkzeug and try installing a specific version manually using the above command
pip install --use-deprecated=legacy-resolver werkzeug==
It will return an error output that will list all the versions it could find
ERROR: Could not find a version that satisfies the requirement werkzeug== (from versions: 0.1, 0.2, 0.3, 0.3.1, 0.4, 0.4.1, 0.5, 0.5.1, 0.6, 0.6.1, 0.6.2, 0.7, 0.7.1, 0.7.2, 0.8, 0.8.1, 0.8.2, 0.8.3, 0.9, 0.9.1, 0.9.2, 0.9.3, 0.9.4, 0.9.5, 0.9.6, 0.10, 0.10.1, 0.10.2, 0.10.4, 0.11, 0.11.1, 0.11.2, 0.11.3, 0.11.4, 0.11.5, 0.11.6, 0.11.7, 0.11.8, 0.11.9, 0.11.10, 0.11.11, 0.11.12, 0.11.13, 0.11.14, 0.11.15, 0.12, 0.12.1, 0.12.2, 0.13, 0.14, 0.14.1, 0.15.0, 0.15.1, 0.15.2, 0.15.3, 0.15.4, 0.15.5, 0.15.6, 0.16.0, 0.16.1, 1.0.0rc1, 1.0.0, 1.0.1, 2.0.0rc1, 2.0.0rc2, 2.0.0rc3, 2.0.0rc4) ERROR: No matching distribution found for werkzeug==
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With