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 when importing flask

    Pythonista
    2
    4
    3613
    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.
    • stef728384
      stef728384 last edited by

      Hi,
      When I import flask I get the error below. I had this before and resolved it by reinstalling pythonista. After reinstalling I can import flask without issues (I am not really using it yet in my scripts but plan to do so soon), but later it fails again.
      Any idea what could be wrong?
      Thanks
      Stef

      import flask
      Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/var/containers/Bundle/Application/C30A01EF-6A6E-4EFE-8956-B463B1F36855/Pythonista3.app/Frameworks/PythonistaKit.framework/pylib/site-packages/flask/init.py", line 19, in <module>
      from jinja2 import Markup, escape
      File "/var/containers/Bundle/Application/C30A01EF-6A6E-4EFE-8956-B463B1F36855/Pythonista3.app/Frameworks/PythonistaKit.framework/pylib/site-packages/jinja2/init.py", line 33, in <module>
      from jinja2.environment import Environment, Template
      File "/var/containers/Bundle/Application/C30A01EF-6A6E-4EFE-8956-B463B1F36855/Pythonista3.app/Frameworks/PythonistaKit.framework/pylib/site-packages/jinja2/environment.py", line 13, in <module>
      from jinja2 import nodes
      File "/var/containers/Bundle/Application/C30A01EF-6A6E-4EFE-8956-B463B1F36855/Pythonista3.app/Frameworks/PythonistaKit.framework/pylib/site-packages/jinja2/nodes.py", line 18, in <module>
      from jinja2.utils import Markup
      File "/var/containers/Bundle/Application/C30A01EF-6A6E-4EFE-8956-B463B1F36855/Pythonista3.app/Frameworks/PythonistaKit.framework/pylib/site-packages/jinja2/utils.py", line 520, in <module>
      from markupsafe import Markup, escape, soft_unicode
      File "/var/containers/Bundle/Application/C30A01EF-6A6E-4EFE-8956-B463B1F36855/Pythonista3.app/Frameworks/PythonistaKit.framework/pylib/site-packages/markupsafe/init.py", line 228, in <module>
      from markupsafe._speedups import escape, escape_silent, soft_unicode
      File "/var/containers/Bundle/Application/C30A01EF-6A6E-4EFE-8956-B463B1F36855/Pythonista3.app/Frameworks/PythonistaKit.framework/pylib/site-packages/markupsafe/_speedups.py", line 7, in <module>
      bootstrap()
      File "/var/containers/Bundle/Application/C30A01EF-6A6E-4EFE-8956-B463B1F36855/Pythonista3.app/Frameworks/PythonistaKit.framework/pylib/site-packages/markupsafe/_speedups.py", line 6, in bootstrap
      imp.load_dynamic(name,file)
      AttributeError: 'module' object has no attribute 'load_dynamic'

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

        @stef728384 , sorry this is not much help to you. But just say I have done an import of flask on the 301011and 211066 betas and it appears ok.

        @stef728384 did you try to reinstall flask instead of reinstalling Pythonista?
        With StaSh a tool written by a forum contributor, you can pip install/uninstall pure python Libs. I know it's not an answer, but it's less drastic than having to reinstall Pythonista

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

          Thank you for your reply.
          I see in stash that flask was not installed using pip... I could install it with pip but I'm afraid for weird side effects..

          I suspect it must be something I installed which are causing this issues. I did install a few scripts using ptinstaller. I uninstalled them but still same error. I did install some packages using pip, like boto3. I'll check what others I installed using pip.

          This is the complete list:
          ywangd/pkg_resources (master) - Copied from setuptools so it can be downloaded separately without the whole lot
          aws (0.2.5) - Utility to manage your Amazon Web Services and run Fabric against filtered set of EC2 instances.
          boto (2.43.0) - Amazon Web Services Library
          Fabric (1.9.2) - Fabric is a simple, Pythonic tool for remote execution and deployment.
          PrettyTable (7) - A simple Python library for easily displaying tabular data in a visually appealing ASCII table format.
          boto3 (1.4.1) - The AWS SDK for Python
          botocore (1.4.66) - Low-level, data-driven core of boto 3.
          jmespath (0.9.0) - JSON Matching Expressions
          python-dateutil (2.5.3) - Extensions to the standard Python datetime module
          docutils (0.12) - Docutils -- Python Documentation Utilities
          s3transfer (0.1.9) - An Amazon S3 Transfer Manager
          futures (3.0.5) - Backport of the concurrent.futures package from Python 3.2
          pyte (0.4.10) - Simple VTXXX-compatible terminal emulator.
          awscli (1.11.10) - Universal Command Line Environment for AWS.
          colorama (0.3.7) - Cross-platform colored terminal text.
          rsa (3.4.2) - Pure-Python RSA implementation
          pyasn1 (0.1.9) - ASN.1 types and codecs
          gitdb (0.6.4) - Git Object Database

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

            I had a feeling boto3 or its dependencies were causing this issue, and seemed to be right.
            I reinstalled Pythonista3 and imported flask without issues. Then I installed ptinstaller and stash and could still import flask (as expected). Then I installed boto3 (and deps) via pip/stash.
            Restarted pythonista and tried to import flask. Then I received this error again!
            Now I just installed flask via pip and this seems to work. I can now import flask and boto3.

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