Forum Archive

Sudden runtime error on iPad

cynicuss

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

omz

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.

JonB

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

georg.viehoever

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

cynicuss

@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

ywangd

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.