• bjh

    I have only two strong opinions on tabs-vs-spaces: 1) I should not have to care or even think about it - it's 2014, for goodness sake, why is this still a thing?? - and 2) mixing indentation styles should be a hard error in Python.

    It's great that Pythonista enables me to tap out a quick test on my iPhone with minimal tedium, but I do most of my hacking on my iPad with a Bluetooth keyboard.

    Because of that, I've switched to tabs for indentation; with tabs to I can get to the "logical" beginning of a line with cmd-left + right a few times (say, 2-4 on average), but with 4-space soft tabs that was 8-16 - or more - right arrows. Tedium. I started having to care.

    (Also, "Convert Indentation" cleans up trailing whitespace? Woo Hoo! I'm gonna run that baby all the time!)

    posted in Pythonista read more
  • bjh

    Late to this party, but here's a slightly more complete version that does QR codes too:

    import webbrowser
    import sys
    
    # From: https://github.com/VisionSmarts/pic2shop-client/blob/master/iOS/Classes/pic2shopClientViewController.m
    #
    # pic2shop always scans UPC-A, UPC-E, EAN13, EAN8 and QR, one cannot restrict to some formats
    # pic2shop will replace "EAN" by barcode or "QR" by QR code
    
    if len(sys.argv)>1:
        #print 'args: ' + str(sys.argv[1:])
        if sys.argv[1] != 'EAN':
            print 'Barcode: ' + sys.argv[1]
        elif sys.argv[2] != 'QR':
            print 'QR: ' + sys.argv[2]
        else: 
            print 'Scan not recognized'
    else:
        webbrowser.open('pic2shop://scan?callback=pythonista%3A//scanner%3Faction%3Drun%26argv%3DEAN%26argv%3DQR')
    

    Save as "scanner" or change the callback URL; also pic2shop doesn't seem to fully escape the QR result ('&' causes trouble, for one)

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!