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.


    No update?

    Pythonista
    20
    95
    58574
    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.
    • cvp
      cvp @Guest last edited by

      @timtim Perhaps could you run this kind of code to execute in Pyto some modules unknown in Pythonista

      import sys
      import urllib
      import webbrowser
      #print(sys.argv)
      if len(sys.argv) == 1:
      #	┏━━━━━━━━━━━━━━━━━━━━┓
      #	┃code to run in Pyto ┃
      #	┗━━━━━━━━━━━━━━━━━━━━┛
      	code = '''
      import urllib
      import webbrowser
      
      import pandas as pd
      data = {
          'apples': [3, 2, 0, 1], 
          'oranges': [0, 3, 7, 2]
      }
      purchases = pd.DataFrame(data)
      
      result = str(purchases)
      encoded = urllib.parse.quote(result)
      webbrowser.open('pythonista3://pyto.py?action=run&argv='+encoded)
      	'''
      	# execute code in Pyto
      	encoded = urllib.parse.quote(code)
      	webbrowser.open('pyto://x-callback/?code='+encoded)
      else:
      	# back from Pyto
      	print(sys.argv[1]) 
      
      pavlinb ? 2 Replies Last reply Reply Quote 2
      • pulbrich
        pulbrich last edited by

        @cvp 😃very creative, best of both worlds... respect!

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

          @pulbrich thank you but it was mainly for fun 😀

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

            @cvp I was qurious about the script, but I received "The file pyto.py couldn't be found", when Pytonista opens.

            cvp 1 Reply Last reply Reply Quote 0
            • pulbrich
              pulbrich last edited by

              @pavlinb did you save the above script under the name of pyto.py in Pythonista?

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

                @pavlinb yes, sorry I forgot to say you have to save the script as pyto.py in Pythonista.
                Thanks to @pulbrich

                All is done in Pythonista, nothing in Pyto but you need to have both apps

                1 Reply Last reply Reply Quote 0
                • ?
                  A Former User @cvp last edited by

                  @cvp I can’t do that since I’m writing code run on iOS, windows and Linux. So I can’t use pyto there.

                  1 Reply Last reply Reply Quote 0
                  • pavlinb
                    pavlinb @pulbrich last edited by

                    @pulbrich Now it works in both directions :-)

                    1 Reply Last reply Reply Quote 0
                    • ?
                      A Former User last edited by

                      @cvp @pulbrich Check your profile pictures, looks funny.

                      cvp 1 Reply Last reply Reply Quote 1
                      • ccc
                        ccc last edited by ccc

                        @timtim said:

                        I’m writing code run on iOS, windows and Linux

                        if sys.platform.startswith(“ios “):

                        ? 1 Reply Last reply Reply Quote 1
                        • cvp
                          cvp @Guest last edited by

                          @timtim said:

                          Check your profile pictures, looks funny.

                          I had remarked similar moustaches but I didn't dare post something

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

                            @cvp said:

                            I had remarked similar moustaches but I didn't dare post something

                            I guess it just comes with experience.

                            cvp 1 Reply Last reply Reply Quote 1
                            • cvp
                              cvp @pulbrich last edited by

                              @pulbrich 👍

                              1 Reply Last reply Reply Quote 0
                              • ?
                                A Former User @ccc last edited by

                                @ccc en… looks ugly. I won’t do that.

                                1 Reply Last reply Reply Quote 1
                                • ccc
                                  ccc last edited by

                                  How could it be ugly? It is Pythonic.

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

                                    Agree, I didn't understand too.

                                    1 Reply Last reply Reply Quote 0
                                    • ?
                                      A Former User last edited by A Former User

                                      It is ugly. I have to write duplicated code for this. And excute it like https://docs.python.org/3/library/functions.html#exec . TOO UGLY.

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

                                        Nonsense.

                                        1 Reply Last reply Reply Quote 1
                                        • upwart
                                          upwart last edited by

                                          @cvp
                                          This absolutely briliant!

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

                                            @upwart Thanks, but only @omz and the author of Pyto are brillant

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