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.


    Widget and requests module

    Pythonista
    2
    4
    3074
    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

      Hi,
      I was trying to check whether it is possible to use the requests module in widget but somehow the widget displays an error saying that there was an error loading the widget.

      I though the problem was with my widget but I get the same error if I add the module requests to then widget example Launcher that comes with pythonista.

      Is this not supported?

      To overcome this problem I was trying to run a script called from the widget itself (that use the requests module). Does anyone knows how to do it without using 'webbrowser.open' which opens pythonista in the foreground?

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

        @djorge webbrowser is not allowed in appex mode, try, instead of webbrowser.open

        	def button_action(self, sender):
        		#import webbrowser
        		#webbrowser.open(sender.name)
        		from objc_util import UIApplication,nsurl
        		app=UIApplication.sharedApplication()
        		urlapp = nsurl(sender.name)
        		app.openURL_(urlapp)
        

        where I've tried 'pythonisyta3://script_name?action=run' and it is ok but it also starts Pythonista

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

          @cvp
          Thats weird. I'm importing appear and using webbrowser.open with that URL and it doesn't complain.

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

            @djorge Sorry but found in Pythonista doc

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