• paultopia

    From the safari share sheet, the following snippet of code

    url = appex.get_url()
    print(url)
    if url is None:
        url = clipboard.get()
    print(url)
    

    if I just run it straight from a web page in mobile safari, it prints None and None

    But if I first copy the url to the clipboard, it prints the URL both times.

    Is there some weird multithreading thing happening here? Can't figure out why else this would be happening.

    posted in Pythonista read more
  • paultopia

    I've been doing some experiments with sharing image files into pythonista from the built-in photos app, to do things like zip up and share elsewhere. But I seem to get inconsistent data.

    Here's my very simple experimental code:

    import appex
    
    def test_save_images():
        images = appex.get_images_data()
        for idx, image in enumerate(images):
            filename = "zfile-" + str(idx) + ".jpg"
            with open(filename, "wb") as ot:
                ot.write(image)
    
    if __name__ == '__main__':
        test_save_images()
    
    

    Then I go into the built-in photos app, select two of photos, and share them into pythonista via "run pythonista script."

    So far, I've done this twice, and neither time has it worked properly.

    The first time, instead of saving both photos into the pythonista filesystem, it saved one photo, twice.

    The second time, it saved both photos, but it saved a total of three photos---it saved one photo once, and one photo twice.

    I obviously find this a little confusing. Why is get_images_data not passing the number of photos that I would expect into the script?

    posted in Pythonista read more
  • paultopia

    Dear kind leader @omz --- now that this has happened, is there any chance you could bundle tweepy with the next version of Pythonista?

    posted in Pythonista read more
  • paultopia

    Hey y'all. I've banged together a simple Dropbox-syncing weight tracker with moving averages (like the old "Hacker's Diet"). The idea is to just stick it in your phone in the long-press menu and then it should be minimal friction to track weight.

    https://gist.github.com/paultopia/95a4c659f2d1971e2e08711d807065d2

    (Though come to think of it, I haven't tested that the dialog menu works right on long-press, or that it sizes right on the phone screen, I just banged it out and tested on the ipad... but I imagine it should work fine on phone)

    posted in Pythonista read more
  • paultopia

    Simple tweetstorm poster (break up long posts into numbered tweets), making use of the lovely api wrapper and ui wrapper omz built into the app. https://gist.github.com/paultopia/13263b605862121e11a737155b2c7779

    posted in Pythonista read more
  • paultopia

    Super-annoying behavior on Twitter: the sort of person who follows you to get you to follow them back and inflate their follower count/promote their junk, then silently unfollows you.

    Problem: twitter terms of service forbid automated unfollowing, while it would be pretty easy to do that anyway, why draw an account ban unnecessarily?

    Solution: find people whom you follow but who don't follow you back, open their twitter pages in a browser tab and decide whether to keep or get rid of them individually, but in a loop. Complies with the letter if not the spirit of Twitter terms.

    Could use a real UI or at least a button or something, but I haven't yet learned how to use the UI module, so.

    https://gist.github.com/paultopia/236bfe61782cd7e5ad7f0a4f00edd202

    posted in Pythonista read more
  • paultopia

    If you just want to grab a script from your Dropbox, here's a simple 8-liner that does it using the share sheet. Put this in your pythonista share sheet extensions, then from the Dropbox app, run the script, and the script will land in your pythonista file system with no fuss or muss.

    https://gist.github.com/paultopia/23703b934c442a54808e245d9418545a

    posted in Pythonista read more
  • paultopia

    Why is this, anyway? Can this be a feature request, to fix this so that just like pythonista can access its own filesystem from the share sheet, it can also access its own keychain from the share sheet?

    It's very weird to create a passwords.json (!!) to get around this...

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!