• 7upser

    You can Start a Shortcut with Pythonista:

    import webbrowser
    vUrl = 'shortcuts://run-shortcut?name=testStartWithUrlScheme&input=10'
    webbrowser.get('safari').open(vUrl)
    

    Maybe you can split your Shortcut into 2 different Shortcuts.
    This should work, if you use Url Scheme on both sides.
    (it's not really in the Bachground, as cvp mentioned)

    posted in Pythonista read more
  • 7upser

    This works for me, the script is in This iPad/dir:

    tag

    The iCloud Path should be:
    /private/var/mobile/Library/Mobile Documents/iCloud~com~omz-software~Pythonista3/Documents

    but i dont use parameter

    Edit:
    Did a test for parameter with url scheme:
    see here: Pythonista Url scheme

    tag

    works too

    posted in Pythonista read more
  • 7upser

    Not iPadOS 14. Nothing is working. 😩
    The only Safari Link i get is:
    localhost:49402
    second try:
    localhost:49404

    posted in Pythonista read more
  • 7upser

    then yes :)

    posted in Pythonista read more
  • 7upser

    @DavinE,

    I think it is a Pythonista Problem with iPadOS 13+

    Btw: you have 2 different Browser:
    iPhone: iPhone (with standard mobile Websites)
    iPadOS: Macintosh (with standard desktop Websites)

    posted in Pythonista read more
  • 7upser

    @mikael, as i write FTL :)

    @Niklas, my Solutions sort on:
    First: 3 digit numbers, leading zeros
    Second: Character

    This are the sort keys (not sorted):

    009Sö
    011Sö
    215U
    005M
    016M
    000
    010M
    001M

    They have all different Numbers, so charakter dont care.

    You can change the regex to whatever you need.

    posted in Pythonista read more
  • 7upser

    I had a similar Problem. I need a german sorted List and locale didn't work with Pythonista. So i have to write my own Sort def. That should solve your Problem.
    But @mikael was faster than light

    
    def myOwnSort(vInput):
        import re
        
        vInput = dict_nested[vInput]['sv_runinskr_trim']
        vInNr = re.findall('\d+', vInput)
        vInNr = int(vInNr[0]) if len(vInNr) > 0 else 0
        vInNr = '{0:0>3}'.format(vInNr)
        
        vInChar = re.findall('\D+', vInput)
        vInChar = vInChar[0] if len(vInChar) > 0 else ''
        
        vNewSortKey = vInNr + vInChar
    
        return vNewSortKey
    
    
    TheOneAndOnlyNewAndPrivateSortedDictionaryWithMyOwnSortKey = sorted(dict_nested, key = myOwnSort)
    
    
    for i in TheOneAndOnlyNewAndPrivateSortedDictionaryWithMyOwnSortKey:
        print(dict_nested[i]['sv_runinskr_trim'])
    
    

    posted in Pythonista read more
  • 7upser

    Still not working, really?

    posted in Pythonista read more
  • 7upser

    @mikael: jesus and wtf and a lot more... :)

    @Seb,
    I come from Basic (ZX81) and be sure i know nothing about best practice. I have only some experience.
    Changing the same variable within 2 defs at the same section of code is a good error source.

    And for Return, its easy you just return a value (or more).

    def function1():
        variable1 = 'Hallo World'
        return variable1
    
    def function2(str1):
        return 'Hello ' + str1
    
    
    print(function1())
    print(function2('World')) 
    

    posted in Pythonista read more
  • 7upser

    Some thoughts from my Side:

    You can iterate your Str keys, no need for keylist.
    In your Function you create a local variable sameletter. You dont change your global Variable.

    Add: global sameletter
    at the start of your functions
    or work with return

    And i dont like the Idea that there are two functions, called directly one after one, and both change the same variable. I think one function is better.

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!