• JonB

    btw, if you go the runpy/cpythonapi route to try to run concurrently,

    ObjCClass('PA3InterpreterWrapper').shebangVersionForScript_()

    might be helpful to tell you which version to run. Then load proper cpythonapi (see the stash thread), then to emulate pythonista evironment reset, you could run the preflight script:

    import os
    version =2 #or 3
    preflight_script=os.path.join(os.path.split(os.__file__)[0],'../../Py{}Kit.framework/pykit_preflight.py'.format(version))
    

    posted in Pythonista read more
  • JonB

    This thread might be useful. Things have changed a bit in recent versions, so i update my original discoveries below:

    If you are trying to emulate play button, it eventually calls:

    I3=ObjCClass('PYK3Interpreter').sharedInterpreter()
    I2=ObjCClass('PYK2Interpreter').sharedInterpreter()
    #pick which interpreter to run (I2 vs I3) and whether to reset environment
    I2.runScriptAtPath_argv_resetEnvironment_('/private/var/mobile/Containers/Shared/AppGroup/C534C622-2FDA-41F7-AE91-E3AAFE5FFC6B/Pythonista3/Documents/Untitled_150.py',['1', 'hello'], True)
    

    (Wrench menu calls the same selector, just with resetEnvironment=False, and populating first argv with editor script name )

    I believe there might be a limitation that if a script is running already, it might be ignored, but i am not sure if that is still true. Polling for running() to return 0 would work, if that was the case.

    Previously, a script had to be open in the editor, but that is no longer the case it seems.

    For running python commands directly via the cpythonapi, see the above thread.

    posted in Pythonista read more
  • JonB

    there are some good tutorials over at pythonista-tools github repo.

    But basically your options are:

    sender.superview['textfield1']
    

    or, storing global references to ui elements you want, or custom view with references stored in self.

    posted in Pythonista read more
  • JonB

    I think part of the concept is mvc where your datasource doesn't need access to the cell (presentation layer) itself -- instead cellforrow produces the cell looking the way you want, and you reload if you want to change it.

    in practice, what you've got seems reasonable.

    posted in Pythonista read more
  • JonB

    One difference is that in pythonista all libraries are static libraries. Most people use ctypes along with objc_util to access ios frameworks. When you import objc_util, you get a c variable that represents the CDLL

    from objc_util import *
    
    >>> c
    <CDLL 'None', handle fffffffe at 0x85c604c>
    >>> print(c.time(None))
    

    there are lots of cool things that can be done with either objc frameworks, or the statically compiled ios libraries

    posted in Pythonista read more
  • JonB

    spoiler alert: pandas is data analysis, but is not supported on pythonista.

    posted in Pythonista read more
  • JonB

    Looks like this is a python2.7 module (relative module imports are handled a bit differently). Switch to the py2.7 interpreter (upper right corner of console for console work, or long press play if you are importing in a script)

    Though, I can't help but wonder if panda is what you think it is... a depreciated api for the now-named telestream video encoding api?

    Or did you mean to install pandas?
    (if so, those playing the pythonista pandas request drinking game should now take a sip)

    Unfortunately the forum search is really bad, but google works well: https://www.google.com/search?q=pythonista+install+pandas+site:forum.omz-software.com

    posted in Pythonista read more
  • JonB

    Does gh actually work for you? I note that jwt requires cryptography for certain algorithms, you can be forced to use pycrypto/ecsda instead. Just curious if anything we are using requires that.

    posted in Pythonista read more
  • JonB

    you are spawning the boss whenever distance <=0 . distance counts down every update(). but I don't see you resetting distance. Meaning when distance goes to 0, boss is spawned every update(), or 60 bosses per second. pretty soon you have thousands of Boss nodes attached to your scene!

    I think you either need to reset distance, or set a flag that the boss is already spawned, etc. or only spawn the boss when distance==0, not <=.

    posted in Pythonista read more
  • JonB

    Hmm, okay, pygithub now depends on pyjwt. It used to be dependency free, so could just install it directly.

    pip install pyjwt
    

    should fix the issue, though i will have to update gh to maybe use pip to install pygithub (or install a specific version).

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!