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.


    Sudden runtime error on iPad

    Pythonista
    5
    6
    3150
    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.
    • cynicuss
      cynicuss last edited by

      I get an error msg now not seen before when I try to run for ex:

      import ui
      def add(a,b):
          result = 0
          while b>0:
      	    result += a
      	    b -= 1
          return result
      
      print add(3,5) NameError: global name '_debug_runtime' is not defined
      

      Or even:

        x = 1
        print x
      

      Same error. This has never happened before. What gives?
      Has Pythonista on my iPad been compromised somehow?
      What's odd tho is that the ones that came with the program still run. Just not the little ones I write.
      I'm being pointed to THIS in stash.py

      def write(self, s, rng=None, update_read_pos=True, flush=True):
          _debug_runtime('Write Called: [%s]\n' % repr(s))
          if not _IN_PYTHONISTA:
              _STDOUT.write(s)
          self.replace_out_buf(s, rng=rng)
          # In most cases, the read position should be the write position.
          # There are cases when read position shouldn't be updated, e.g.
          # when manipulating input line with completer.
          # Also read position can never decrease in a stream like output.
          if update_read_pos and self.write_pos > self.read_pos:
              self.read_pos = self.write_pos
          if flush:
              self.flush()
      

      Thanks

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

        I would suggest that you restart the app (quit it completely from the app switcher), and then turn off the "reset global variables" option in the settings (under interpreter options), if you want to continue to use stash.

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

          the latest version of stash now has a launcher that survives clearing of globals

          1 Reply Last reply Reply Quote 0
          • georg.viehoever
            georg.viehoever last edited by

            @JonB unfortunately only in the dev branch, not yet on Master...

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

              @omz thank you. Up and running again. And @JonB, given who I am (rank recreational amateur with no clue but having fun on the fringe), am I doing myself and the community a disservice reloading "stash" ? (Don't want to waste your time begging for answers.) I used it solely for unzipping files.

              Thanks

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

                The launch_stash.py script has now been merged to the master branch.

                Using the launcher script to run StaSh ensures it survive through Pythonista's "global variable clearing" feature (enabled by default).

                Please run selfupdate inside StaSh to get latest changes. As a side note, if you wanna grab the dev branch, you can also do that easily by running SELFUPDATE_BRANCH=dev selfupdate.

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