Error Running Flask latest beta
Guys, I am having a problem getting the minimal flask app running on the latest beta, iOS11.2.1.
The code below. It works under py 2.7 in the beta. I remember an error I had before was with the debug param. But this is correct now. I did a pip install of fllask(full restart etc) to see if that would help. But the same error.
I always seem to have problems getting started with flask :(
Any help appreciated
from flask import Flask app = Flask(__name__) @app.route('/') def entry_point(): return 'Hello World!' if __name__ == '__main__': app.run(debug=False)
Traceback (most recent call last):
File "/private/var/mobile/Library/Mobile Documents/iCloud~com~omz-software~Pythonista3/Documents/FlaskTesting/flask__testing.py", line 1, in <module>
from flask import Flask
File "/var/containers/Bundle/Application/F132DFB7-BD77-4096-ADA6-D8CA8F4468F2/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/flask/init.py", line 19, in <module>
from jinja2 import Markup, escape
File "/private/var/mobile/Containers/Shared/AppGroup/3533032E-E336-4C25-BBC4-112A6BF2AF75/Pythonista3/Documents/site-packages/jinja2/init.py", line 37, in <module>
from jinja2.environment import Environment, Template
File "/private/var/mobile/Containers/Shared/AppGroup/3533032E-E336-4C25-BBC4-112A6BF2AF75/Pythonista3/Documents/site-packages/jinja2/environment.py", line 575
info.external_attr = 0755 << 16L
SyntaxError: invalid token
@Phuket2 Any particular reason you're not using the bundled version of Flask? There's no need to install anything to run the script you've posted, and it works fine here...
@omz , As far as I can tell I am using the pre installed version of Flask. When it failed, I just tried to pip install it. It didn't work so I pip remove 'ed it. I have looked though my site packages folder and I have no folder named flask, si I am assuming it's using the shipped version. I have done hard restarts on Pythonista also
@Phuket2 It seems that Flask is importing
jinja2, and you have a version of that in your
site-packages, possibly one that only works on Python 2. Try removing
site-packages, then restart Pythonista.
@dgelessus , thanks that was the problem.....Not sure why my brain goes blank. I should have looked for that
@dgelessus , oh I can see where it all went wrong now. I pip installed flask-restful, that also installs flask and jinta. I have been able to re-install flask-restful and delete the folders in the site-packages and have it working now. Thanks again.