• omz

    @jsamlarose47 Could you try restarting Editorial? Not 100% sure why right now, but it seems to help.

    posted in Editorial read more
  • omz

    The general possibility of installing pure Python packages is the same in Pythonista and Editorial, though it may be slightly more convenient in Pythonista because there are some existing (third-party) tools around that. However, there's usually not much more to installing a module than downloading a zip/tar.gz file from somewhere, and copying some files from it. You can do that in a couple lines of Python.

    posted in Editorial read more
  • omz

    Congrats, you found a bug! ;)

    In short, the FILTERING_NEAREST constant is defined incorrectly, so it actually has the same value as FILTERING_LINEAR (the default). As a workaround, just set the filtering_mode attribute to 1 instead of using the named constant. This will continue to work, even when the bug is fixed in the next update.

    One more thing: If you're working with subtextures, you need to set the filtering_mode for each subtexture separately; the main texture's mode has no effect on subtextures that are created from it.

    posted in Pythonista read more
  • omz

    This works for me:

    from objc_util import *
    
    def get_ssid():
        CNCopyCurrentNetworkInfo = c.CNCopyCurrentNetworkInfo
        CNCopyCurrentNetworkInfo.restype = c_void_p
        CNCopyCurrentNetworkInfo.argtypes = [c_void_p]
        info = ObjCInstance(CNCopyCurrentNetworkInfo(ns('en0')))
        return str(info['SSID'])
    
    print('Current SSID:', get_ssid())
    

    posted in Pythonista read more
  • omz

    Try adding load_framework('SceneKit') before the line with the error.

    posted in Pythonista read more
  • omz

    @NikkiSchwartzVB You could abuse the "Get/Set File Contents" actions for storing variables that should persist after a workflow has finished. You'll want to use a local file with a unique name, and you might want to use a name that starts with . because it won't show up in the file list that way.

    posted in Editorial read more
  • omz

    @NikkiSchwartzVB Do you mean something like "If [value] is A, B, or C, do this"? Or rather, "if [value] is A, do this, if value is B, do that..."?

    posted in Editorial read more
  • omz

    @metawops It's possible to open the Photos app using webbrowser.open('photos-redirect://') but I'm not sure if there's a way to show a specific photo or album that way.

    posted in Pythonista read more
  • omz

    @metawops I'm not quite sure yet where the timestamp issue is coming from, but it seems to be a bug. As a workaround, you can set asset.creation_date to datetime.datetime.now() manually, after creating the asset.

    posted in Pythonista read more
  • omz

    import photos
    import ui
    
    def add_to_album(image_path, album_name):
        # Find the album or create it:
        try:
            album = [a for a in photos.get_albums() if a.title == album_name][0]
        except IndexError:
            album = photos.create_album(album_name)
        # Add the file as an asset to the library:
        asset = photos.create_image_asset(image_path)
        # Add the asset to the album:
        album.add_assets([asset])
    
    # Demo:
    if __name__ == '__main__':
        img = ui.Image('test:Lenna')
        png_data = img.to_png()
        with open('.temp.png', 'wb') as f:
            f.write(png_data)
        add_to_album('.temp.png', 'My Pythonista Album')
    
    

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!