omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    Error Running Flask latest beta

    Pythonista
    flask
    3
    6
    4780
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Phuket2
      Phuket2 last edited by

      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 -
      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

      1 Reply Last reply Reply Quote 0
      • omz
        omz last edited by

        @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...

        Phuket2 1 Reply Last reply Reply Quote 0
        • Phuket2
          Phuket2 @omz last edited by

          @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

          1 Reply Last reply Reply Quote 0
          • dgelessus
            dgelessus last edited by

            @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 jinja2 from your site-packages, then restart Pythonista.

            Phuket2 2 Replies Last reply Reply Quote 1
            • Phuket2
              Phuket2 @dgelessus last edited by

              @dgelessus , thanks that was the problem.....Not sure why my brain goes blank. I should have looked for that

              1 Reply Last reply Reply Quote 0
              • Phuket2
                Phuket2 @dgelessus last edited by

                @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.

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post
                Powered by NodeBB Forums | Contributors