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.


    Unable to launch_stash.py in pythonista 3 for IOS

    Pythonista
    pythonista 3 stash
    5
    15
    14572
    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.
    • JonB
      JonB last edited by

      1. What pythonista version are you using? The latest app store version, or the beta?
      2. The parse error indicates that your Info.plist is corrupted. You should try removing/reinstalling pythonista. If you have pythonista 2.0 installed, you won't lose any files, otherwise you need to back up first.
      3. The ConfigParser error is because you are running stash with python 3.x -- stash is only compatible with python 2.x (which is why launch_stash has the #!python2 at the start.
      4. As a workaround, you could also comment out the offending line from shcommon.py, and just set
      PYTHONISTA_VERSION='3.1.1'
      PYTHONISTA_VERSION_LONG='311016'
      

      (thats from the beta, but it does not really matter as long as the version is > 3.0)

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

        one more thing to look at before reinstalling pythonista:

        import sys, os 
        print(open(os.path.join(os.path.dirname(sys.executable), 'Info.plist')).readline())
        

        you also never said what device /os versionyou are using -- has ios started switching over to binary Info.plists?

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

          Hi @JonB ,
          I appreciate your help and I hope we will find the solution soon as I can’t wait to develop some stuff in Pythonista...

          Here is the Info that I thought I already said:

          • Ipad 10.5
          • IOS 11.1
          • Pythonista 3.0 version

          I reinstalled Pythonista and then first thing I did is to download “stash”, then I ran “launch_stash.py” with version python 2.7 but still....same error.

          I also tryed to run what you asked, here is the output:

          7793ae5c-211f-4a3e-b8a1-e99cfbabb146

          I tried to change what you suggested in “shcommon.py” but it didn’t fix anything:

          7ec15fb6-a2ff-4693-a365-ffb159c94f75

          Thank you

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

            @siulman Can you try running this and post the output:

            import sys, os 
            print(repr(open(os.path.join(os.path.dirname(sys.executable), 'Info.plist'), 'rb').read(256)))
            

            @JonB I have an idea what the issue could be. Pythonista's Info.plist might be a binary plist (rather than XML) in the current App Store version of Pythonista. The Python 2 version of plistlib only supports XML plists I think. The Python 3 version supports both and detects the format automatically.

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

              yeah, binary plist is what i was thinking. (I think it must be an ios 11 thing?)
              The solution in 2.7 would then be maybe to use objc rather than plistlib:

              if IN_PYTHONISTA:

              from objc_util import NSBundle
              PYTHONISTA_VERSION=str(NSBundle.mainBundle().objectForInfoDictionaryKey('CFBundleShortVersionString'))
              PYTHONISTA_VERSION_LONG=str(NSBundle.mainBundle().objectForInfoDictionaryKey('CFBundleVersion'))
              
              
              if PYTHONISTA_VERSION < '3.0':
              ....
              
              1 Reply Last reply Reply Quote 0
              • siulman
                siulman last edited by siulman

                Appreciated guys...
                @dgelessus here is the output you requested:

                b259d311-7b4e-4c24-9ab8-1d7e8e34d2ad

                @JonB Any workaroung you come up with to make that work?

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

                  @JonB What exactly does Stash use the Pythonista version number for? If you only need to know whether you're in Pythonista 3 or not, you could probably check sys.executable.endswith("3") instead, or see whether Py3Kit.framework exists or not.

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

                    I think it just uses it to report version # at startup, and check for pythonista 3.

                    The code I posted above should work, in shcommon.py. objc_util is probably overkill, but already imported for stash.

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

                      Hello guys,

                      I modifyed the “shcommon.py” according to the @JonB suggestions and it worked.

                      I was also able to “pip install netmiko” and connect to my switches to execute the commands I wanted to. I am really happy now! Thanks!

                      Here below snapshots.

                      I think this should be taken into account for a new release of the app?

                      Thank you very much for your help @JonB as long as @dgelessus

                      96bbe954-86de-4a66-b8af-c15a5430fbbf
                      a22d32a4-f623-4bf2-aa3e-7ea04b073ea4

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

                        if you'd like. you can submit a pull request over on the stash github page. If not, I will do it this week.

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

                          I ran into the same problem today. After reading through this thread I realized perhaps it had to do with having both Pythonista 2 and the new Pythonista 3 installed. I uninstalled both and reinstalled 3 and it fixed the problem.

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