• Oak

    Hey guys, I can't figure out how to do this. Basically I have several sets of coordinates in Pythonista (a list for all the latitudes and a list for all the longitudes, as well as a list containing the feature names). I want to be able to choose from a list of these points in Workflow then have it show that point (or route to that point) in Maps.

    The problem is, I don't know how to pass data like this from Pythonista to Workflow. Also, the number of point data will be variable, so that complicates things; I may need to pass anywhere from 1 feature to 20+ features to choose from in Workflow. But then again, I also suppose I could script the "choose" part in Pythonista so that only one latitude and one longitude would need to be passed to Workflow. That might be easier.

    In a perfect world I would like all of this to be done in two presses.. One to start the chain reaction, and one to choose which point to access.

    Anybody have any idea how to do this??

    posted in Pythonista read more
  • Oak

    Thanks Jon! I'll for sure check it out. I didn't know there was a beta.

    And another UPDATE: Got my script finished. In order to do the list I ended up using a loop to print all the options, then a simple raw_input to define a variable which assembles the coordinates to be copied to the clipboard. Then I used the above URL callback code to open the Workflow app that instantly draws from the clipboard to open the point up in Maps.

    posted in Pythonista read more
  • Oak

    UPDATE I figured it out

    I used <code>webbrowser.open('workflow://x-callback-url/run-workflow?name=CoordsMap')</code> to open the workflow and <code>clipboard.set(Coordinates)</code> to pass the variable. In Workflow I'm literally just going to have two actions: Get Clipboard and Show In Maps.

    Now I need to figure out a way to be able to choose from a varying list in Python...

    posted in Pythonista read more
  • Oak

    Hi all, I have an issue that I absolutely cannot get around. When I run my script in the app, it works perfectly fine. Everything is normal. When I call my app through Safari it still runs normally, with the exception that it refuses to append to another file.

    So to be clear: the only problem is when accessing the closed app using Pythonista://CoordinatesGet.py?action=run it doesn't write to my file. It DOES write to my file if I call it again, with the app already open, and it DOES write to my file when running the program normally from within the app. Here is my code:

    <code>
    theFile = open('CoordinatesList.txt','a')
    import location
    location.start_updates()
    myCoords=location.get_location()
    location.stop_updates()
    longitude=str(myCoords['longitude'])
    latitude=str(myCoords['latitude'])

    theFile.write('\n')
    theFile.write(longitude)
    theFile.write('\n')
    theFile.write(latitude)

    print 'Coordinates:',latitude, longitude
    </code>

    I really appreciate the help! I'm starting to think it's a bug.

    posted in Pythonista read more
  • Oak

    Thank you all, you were most certainly right! File was not closing. I have fixed it now by simply using <code> with open </code> for the file.

    Thanks again!

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!