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.


    appex.get_input> returned a result with an error set

    Pythonista
    3
    5
    3731
    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.
    • djorge
      djorge last edited by

      I'm trying to capture text from Unread app, but appex.get_input() returns an error

      #coding: utf-8
      import appex
      
      appex.get_input()
      

      Returns:
      UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
      File "/private/var/mobile/Containers/Shared/AppGroup/B6AB638B-3B3D-4649-85A1-8E5C6F750259/Pythonista3/Documents/Scratchpad.py", line 4, in <module>
      appex.get_input()
      SystemError: <built-in function get_input> returned a result with an error set

      Need help please!!

      Thanks in advance.

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

        I have made some more tests and I found this only happens when there is an image in the feed item. At least, when I try to use the "Image Histogram" it shows an histogram.

        I also found a weird behavior while using the scratchpad and the console with the same feed item when it has an image. In the console I am able to print the title with

        print appex.get_input()[0].get('title') 
        ``
        But if try the same code in the scratchpad with:
        

        #coding: utf-8
        import appex
        print(appex.get_input()[0].get('title'))

        I get an exception 
        

        UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte

        During handling of the above exception, another exception occurred:

        Traceback (most recent call last):
        File "/private/var/mobile/Containers/Shared/AppGroup/B6AB638B-3B3D-4649-85A1-8E5C6F750259/Pythonista3/Documents/Scratchpad.py", line 6, in <module>
        t = appex.get_input()[0].get('title')
        SystemError: <built-in function get_input> returned a result with an error set
        UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte

        During handling of the above exception, another exception occurred:

        Traceback (most recent call last):
        File "/private/var/mobile/Containers/Shared/AppGroup/B6AB638B-3B3D-4649-85A1-8E5C6F750259/Pythonista3/Documents/Scratchpad.py", line 5, in <module>
        print(appex.get_input()[0].get('title'))
        SystemError: <built-in function get_input> returned a result with an error set

        What I am doing wrong?
        1 Reply Last reply Reply Quote 0
        • ccc
          ccc last edited by ccc

          .encode('utf-8') or .decode('utf-8') is probably your friend...

          https://wiki.python.org/moin/UnicodeDecodeError

          Also piles of similar entries in StackOverflow.

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

            Are you using the App Store version or the beta? I suspect this might be a bug in the appex module that I already fixed in the beta, but I could be wrong.

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

              @omz I'm using the Appstore version.
              I was told on slack that this is already solved in beta an I have already sign-up last month but didn't receive invitation yet.

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