• robopu

    @JonB .. your link to copy filesave never worked. i tried it a number of times. the code runs, the file is created but it's empty. perhaps the path is not correct or i need a github token or something?

    that said, by manually pasting the filesave script, i was eventually able to get this to run and it works downloading the gist i specified above! i confess, it took me a number of iterations to try and assign the script to an "appex action" thing or whatever it's called so that it showed up from the share sheet extension automatically but somehow it eventually did.

    your instructions were different from what i saw on my iphone.
    the wrench only appears when editing a file. once you click the wrench, you have an Edit button that allows you to add a blank "icon" with a plus in it. from there you choose the file to assign to the icon which then shows up one you drill back to pythonista from the share sheet.

    anyway : just so i'm clear. for the share sheet to work correctly, do these icons assigned to pythonista scripts need to exist (ie it's the glue that the share sheet looks for)? or put another way do pythonista scripts only recognize the appex data when called in this way? because before i could assign the icon to the filesave script, when i share sheeted from safari back to pythonista it dropped me in the editor. if i then navigated to savefile and ran it manually, it didn't appear to be able to access the appex data of the last page i was on in safari. my guess is the answer is yes.. savefile needs to be tied to the icon which is what you call the appex extension??

    thanks for being patient and following this through. much appreciated. i got it working just want to make sure i'm understanding the right process for interfacing with appex data via share sheet

    posted in Pythonista read more
  • robopu

    actually i just got this download script to work in pythonista console and successfully downloaded your zipfile. however it just doesn't work in the editorial console even with fresh pastes. it keeps telling me download_file is "name not defined". perhaps python version issues between the two apps?

    posted in Pythonista read more
  • robopu

    i've had nothing but trouble downloading stuff.. the script i copied in to the console doesn't work in editorial for some reason.. no errors when i paste and enter the script. but the console can't even find the download_file function afterwards. it's showing as download_file not defined. i've spent so much time just trying to get basic things working in these apps. it's frustrating. i confess i don't usually use the console. i'm used to writing python scripts in files and running the files so this is a bit new to me. i wish i had an ipad. trying to do all of this on a small iphone is tiring. any thoughts on what i might be doing wrong? i've copied this script verbatim..

    posted in Pythonista read more
  • robopu

    one last question for tomorrow.. you said:

    • Download the filenav source code as a zip from GitHub and import it into Editorial

    i'm still in the process of figuring out how to download things to pythonista via a variety of methods. but i've never downloaded anything into editorial yet. so is there an existing workflow in editorial to import and or download the zipfile directly or via pythonista. or some quick code i can cut and paste in a workflow to get the code base local to editorial. sorry for not knowing how to do that.

    thx

    posted in Pythonista read more
  • robopu

    awesome. i'll give this a look tomorrow. thx!

    note that even if it cuts the names off, based on when i ran your old filenav script in editorial earlier, the font is much smaller (and my guess is i can configure that), so that i see enough of the filename to give me the context i need vs the stock editorial file browser..

    it sounds like you're focus is more on pythonista but do you know if the custom ui modules works the same in both editorial and pythonista? i get the feeling they may be identical which means pure ui interface code should work well in editorial if borrowed from pythonista and vice versa. your filenav would seem to bear that out.

    finally, i found an editorial workflow in the online directory that almost gives me everything i want (though much less functionality than your filenav as it only allows listing one directory with no directory walk down to child dirs). it uses a ui tableview to select the filename from dropbox (this works!) but it doesn't actually set the row text as workflow output variable which means workflow input is empty in the next step which tries to open a blank filename? i don't see anything in the documentation that explains if / how tableview selections are supposed to trigger setting a default workflow output var for the next step. but the ole the guy who wrote this apparently thought it would work as is. i posted specific details in the editorial forum (summarized pretty well here though)

    https://forum.omz-software.com/topic/5048/custom-ui-not-setting-tableview-clicked-item-in-workflow-list-folder

    do you know the best way to get the selected row from a tableview out and to the next workflow step in editorial or why it's not being set by default?

    thx as usual!

    posted in Pythonista read more
  • robopu

    i'm trying to use a workflow that lists files in a given directory (that you specify in the workflow before you run it)

    http://www.editorial-workflows.com/workflow/5426908476997632/PgaPaB0sSXw

    i believe this was written by @olemoritz (aka @omz ??)

    i can actually get the workflow to list files in my specified dropbox directory in a custom tableview! which is great! that's the hard part.

    when i select the file, the tableview doesn't do anything.. it just sits there waiting. however there is a " Continue" Button right up at the top of the view, so i hit that and it appears this triggers the next step, which is a python block to open the file, in the workflow. (fyi, nothing i can find in the ui documentation tells me anything about the Continue Button or default tableview behavior but based on what i'm seeing it is indeed going to the next step in the workflow)

    the problem is that what is being selected in the tableview is NOT being passed by default to the workflow input function of the next python block! as a result the directory full path to open the file is correct but the basename of the file is missing and thus editorial can't open the file since the filepath is incorrect.

    the question i have is :

    how do i get the value selected in a tableview row to automatically set and be the workflow input of the next step? i assumed this was the default behavior but if it's not how do i explicitly set an appropriate var so it can be passed to the next step and more importantly where do i do it in the UI editor? i dont' see any mention of how this is handled in the custom ui documentation but it's crucial to using any custom ui element.

    thx

    posted in Editorial read more
  • robopu

    @JonB sorry but unfortunately your install link for filesave is failing for some reason.. error is something about AttributeError __enter__ followed by .exec_from_url.py <module> (Line 13)

    not sure what's going on.

    also from your last reply "click back a few times untill you get to the main appex page. should have edit in upper left, and some icons below. you wNt to add savefile to the bottom icons." doesn't really look the same to me as you describe. maybe because i'm on an iphone7 vs ipad?

    i'm not sure what the main "appex" page means unless that was spellchecked for " index" :), once there, i see "Edit" button but it's in top right vs left.. The icons below are simply my normal pythonista file browser listing with icons for folders and files with their appropriate names. python actualy opens the file filesave.py into this location but because of the script failure nothing actually gets written so that when you open it to run it, it's empty..

    thx

    posted in Pythonista read more
  • robopu

    i'm wondering how to specify my dropbox folder (what is the path) using python in editorial so that i can get a list of files in that folder?

    also is the ui module in editorial and pythonista the same? ie if i borrow ui code from pythonista community which is more active than editorial will it work in editorial? from what i can tell they're identical.

    finally, it looks like editorial comes with a useful list of python modules to use but if for some reason i want to pip install something else not already included, is it possible and if so how?

    thx

    finally,

    posted in Editorial read more
  • robopu

    @JonB .. ok just to confirm..

    • i'm on the gist page..
    • this time i do NOT try and copy the url i simply click Share button in safari
    • then i click " Edit Scripts" which brings me to pythonista
    • in pythonista i don't have a + option like you mention but i see my filesave.py file right in my local directory listing in the file browser (probably b/c that's where i last was in pythonista) so i simply select the file which loads it into the editor
    • the script is just sitting there in the editor and does nothing on it's own so i click the "right arrow symbol" to run the program..

    when i do that i get this error in the console:

    Traceback (most recent call last):
      File "/private/var/mobile/Containers/Shared/AppGroup/50D9A78C-3AC4-470C-908E-FB2D1012D385/Pythonista3/Documents/gitsavefile.py", line 9, in <module>
        urlfilename=unquote(unquote(urlparse(appex.get_url()).path.split('/')[-1]))
    TypeError: a bytes-like object is required, not 'str'
    

    so it looks like it's expecting bytes and not a string?

    thanks for the clarification on how the script was supposed to work?

    posted in Pythonista read more
  • robopu

    @JonB thx for followup.. i'm not sure i'm following the link you posted in the bottom of your reply. i would think i have no control over what the share sheet is sending to savefile.py.. so how do you know what is being set in the call back url from the share sheet in the first place? i'm curious because maybe that's part of the problem of why it's not working?

    i thought that regardless of whether i ran from the share sheet in the form of an x-callback or simply copied the url in safari and run the script manually when i switch back to pythonista with url in the clipboard, that the only argument to this script is the url of the gist? but it looks like a bunch more things are being populated in the link you pasted.

    also, perhaps i'm copying the wrong url?
    this is the link i'm highligting and copying before running the script?

    https://gist.github.com/omz/fb180c58c94526e2c40b

    by default what directory will savefile put the downloaded gist?

    fwiw, after spending a couple of days trying to get all this to work it would have been easier but not simple to just copy and paste the gist code in safari directly into a new pythonista file except for the fact that for some reason that "select all" is not allowed in safari gist text on my iphone7 which means i have to tediously drag to try and select everything past 1+ scrolls which often fails before i can actually copy!??

    thx for the help!

    posted in Pythonista read more
  • robopu

    can anybody recommend / point me to a link of a gist download script that currently really works (ie will actually take the url of a gist copied from iphone safari and turn it into an actual file in pythonista)?

    i've finally got stash running and git clones of repos work fine but for some reason not downloading a gist at a given url (unless i'm doing something wrong)? curl didn't work and i forgot if i tried wget or not in stash as well.

    i just want to get up and running with this application in terms of integrating with relevant files already existing in git out there on the net. it's a catch 22 because the solutions that already exist are in git but which you can't git because you can't git from within pythonista natively. ;) once you get a reliable git tool my guess is things get easier :)

    fwiw, i've tried the solutions recommended on this link and neither seem to work regardless of whether i manually copy the link and manually run the script or run the script via the share sheet in safari.

    https://forum.omz-software.com/topic/3435/gist-file-retrieval/11

    https://gist.github.com/Mr-Coxall/7fbf6dc0ec3d83525f1944812ccce46f

    https://gist.github.com/jsbain/fcb3f42932dde9b0ff6c122893d1b230

    btw, i think one of the problems wiht one of the scripts is that it's written in python 2.x but when i try to run it from the share sheet it won't allow me to choose which interpreter i want to use? am i seeing this behavior correctly?

    thx!

    posted in Pythonista read more
  • robopu

    @dgelessus much appreciate that detailed followup.

    so the downer with icloud for me is that it's opt-out and not opt-in which i just think is lame for a trillion dollar company who's products are already over-priced as it is. ;) based on my past experience, i think what i saw is that whenever i upgraded / dated ios, i would have to go back in and opt-out of all these different things that i didn't want icloud resetting to go to the cloud. it's just a personal pet peeve and i don't like rewarding bad behavior. i'm generally just not a fan of sticking my whole life up in the cloud which is apple's default approach. dropbox while still cloud allows me to set one folder only and not worry about "side-effects" since they don't "own" the operating system providing the service.

    regarding execution of files on DB. i think you're probably right with regards to reading in other files from the DB folder. i only tested a single file python program. on the plus side, the DB python program WAS able to find the libraries it needed in the local pythonista packages directories so that's good. anyway, i guess i'm going to need to sort through and download one of the DB file pickers to pull in multi-file projects locally.

    regarding my seeing stash running from your filenav .. yeah it must have been shellista i saw back in editorial ;).. i clicked on an interface widget for shellista and it tried to do something and failed (probably b/c it wasn't installed ;)). i've already installed stash in pythonista (not sure how to do that in editorial or if i even need it there anyway). i think i discovered it needs to run in python 2.x to work though??

    regarding filenav old single file version on editorial. it worked in the sense that it loaded some folders properly and allowed me to navigate those folders. the problem is that they're none of the folders that i need including DB and local markdown files ;)... i guess you're not sure what those paths should be set to in editorial? since it's already single file and currently working, i imagine if i edit your code to look in "the right" directory(s) it should "just work" right?

    i'm not sure how or if it's even possible to make multiple file programs run in editorial either.. so outside of refactoring your recent filenav multi-file into one large program, fixing up the paths in the older one or trying to roll a new one, i'm probably leaning towards getting the old single file working with new paths.

    outside of being able to set multiple paths in the newer multi-file filenav, is there anything (radically) different about it vs the original one? my motivation believe it or not for a replacement file browser in editorial vs the stock one (as expressed on the other thread) is i can't see the long filenames in the stock file browser. your filenav seems like it might accommodate that based on what i've seen so far.

    finally, there is a file in your more recent filenav repo called filenav_v1.py. i searched the repo on github and it doesn't appear that this file is imported anywhere (an artifact??) and that main() simply sets up things based on two files, slim and full, based on the device size. sound right?

    thx

    posted in Pythonista read more
  • robopu

    thanks for the reply @dgelessus

    it sounds like icloud is an easy way to go. i'm just leery to use apple's icloud service though. partly for privacy reasons and partly because i don't like keeping my cloud service client apps on unless i'm actually using them and in the past when i would re-enable icloud it always seemed to want to turn on more globalized synching (synching things i configured it not to) then what i originally configure it for. maybe it's different now. when you sync with icloud can you lock it down to just one synch folder?

    i'm playing around with dropbox right now and it looks like i can run python scripts directly from my dropbox synced folder (vs having to copy them down locally first) so i already may have my own cloud solution my own files. i only tested it with a simply print script but it worked. however, this contradicts much of what i think i've been reading in the forums / online about needing extra scripts to download / sync dropbox python scripts locally. perhaps that's because people develop locally in pythonista and need to move scripts back and forth between dropbox and local files in pythonista (ie that support is not native meaning you either run and edit the files in dropbox OR locally and that there is no native support to move the files back and forth between the two)?

    so stash isn't stock provided in pythonista and i have to download it separately. i couldn't tell because i think i just ran one of your own file browser scripts in editorial and i think there was an option to use stash so i clicked it and it seemed to want to run (meaning it is provided in editorial but not pythonista)?

    thanks for the input. i do have a followup regarding your file browser script for editorial since it's somewhat related here. it looks like i downloaded an older version from the workflows directory of your script (tutorial doctor posted the workflow but it's your script :)).

    it runs in the sense it provides a nice file picker. the problem is it doesn't show meaningful folders. it doesn't list my mounted dropbox folder (though it shows the dropbox trash folder?). it also doesn't show my local documents folder in editorial where all my meaningful local documents are. would you know why it isn't working or if your new version in git (which isn't included in the current workflow online) takes care of the problems? my guess is it has to do with the root paths. what is the correct root path of the mounted dropbox directory in current versions of editorial?

    here are the links i used for your workflow and code

    http://www.editorial-workflows.com/workflow/5288909432946688/i_MCDS0kmIQ

    https://forum.omz-software.com/topic/1565/filenav-a-simple-file-navigator/36

    here is my other post today that relates to finding a dropbox file browser that might allow me to see the full names of the long file names vs the stock editorial file browser.

    https://forum.omz-software.com/topic/5041/seeing-long-filenames-in-the-file-browser

    thanks

    posted in Pythonista read more
  • robopu

    ah i see.. you view the TOC natively as md and then swipe to preview it in the browser, touch the link and it returns you to the editor with filename via the callback.. gotcha..

    still would like to see some other solutions hopefully a native one to the stock file browser if possible :) i think i may have just found a file brwoser workflow out there. i need to download it and see if it makes a difference or maybe can be modified in some way to do what i want.

    thx again!

    posted in Editorial read more
  • robopu

    i purchased pythonista more than a year ago and i never got around to using it much due to schedule. i'm revisiting it right now and i'm wondering what the best current methods are for getting files back and forth (though actually mostly to) to pythonista from a macbook. basically what i'd consider round tripping the files in an easy / intuitive manner?

    MY OWN CODE

    i only have an iphone7 so my screen real estate is really small. that means for pure python code that doesn't require any custom pythonista ui / ios modules, i can actually develop and debug most of my code a lot easier on the macbook with a better more powerful environment. but i need the most easy / intuitive way to get the files back into pythonista when it comes time to put them in the pythonista environment where i can use an external keyboard.

    i'm quite ok simply transferring my own python files locally from my macbook to pythonista but i didn't see pythonista listed in the new files app in ios 11. i should double check and see if pythonista allows direct app transfers in itunes though as a possible solution (though i confess i personally think itunes is horribly designed and makes this a last resort when combined with ios's sandboxing)???

    also maybe it's better for me to push my local code to git and pull into pythonista that way (see next)?. or simply sync to dropbox and pull from dropbox? (fyi cloud is not an option for me)

    OTHER'S CODE (GIT etc..??)

    more importantly, much of the code recommended in the forums exists in git, so i also need an intuitive method to pull from git directly to pythonista as well. oddly enough part of simplifying the equation here is finding and then pasting an appropriate git url into whatever tool is going to be used to clone the code into pythonista. i often search the forums on my macbook because it's easier to type and search etc on the macbook but i then need to get the appropriate link back to pythonista and whatever utility is going to be used to download the code locally on the iphone7. i think maybe a lot of the folks in the forum might be using pythonista in an ipad environment which gives them more options to do this locally more efficiently on the device?

    i've cruised the forums and there are a variety of methods going back years and it's not exactly clear to me what's the best way to do this. are the appropriate scripts already in pythonista's installed code base or do i have to download something from somewhere else first and if so what are currently the most intuitive methods?

    basically i'm excited to use pythonista but once i fire it up and want to leverage existing code that originates elsewhere, i can't figure out how to easily download it locally :) it's the biggest hurdle to using the app.

    any current recommendations are welcome. thanks

    posted in Pythonista read more
  • robopu

    so you're saying create another python script that reads the directory of files, converts filenames into markdown links, output to a file, which i make a bookmark out of to load in the internal editorial browser to jump back to editorial editor view of the file :)

    i guess i could maybe just run the python file every time i wanted to pick a file to automatically open the editorial browser because it's going to have be constantly rebuilding the file anyway as i add files. maybe tie it to a quick snippet so the script is easy to access.

    it's an option. thanks for the idea!

    would still like to find something native if possible first and open to any other creative suggestions. long filenames are kind of common and for some reason i think an app's stock file browser w/should be able to support them out of the box

    posted in Editorial read more
  • robopu

    hey @wbjethro that would be the simple filesystem solution but creates an extra layer of complexity and unnecessary navigation in the filesystem for files that are logically grouped imho. at that point i'd just be navigating up and down and back and forth to put myself in teh appropriate directories which would just add a different kind of extra "gesture" effort, brain drain and time to the basic operation of opening a file.

    basically having multiple directories just shifts the same problem i'm having but to directory navigation. i have just the right amount of files where breaking them out into subdirectories doesn't pay any dividends and not enough to make navigating one directory a problem. the one directory solution make managing the files much easier on a laptop (where i have plenty of screen real estate) and then the eventual sync to the dropbox.

    thanks for the suggestion though!

    posted in Editorial read more
  • robopu

    I work with lots of files that absolutely need to be prefixed so that they can logically be grouped together in the filesystem. the unique part of each filename is then appended to the prefix after a hypen.

    i also run editorial on an iphone vs an ipad.

    unfortunately, this means that when i try to pick files to edit in the editorial file browser, the "unique" part of the filename is always fully or partially "hidden" out of view due to the width of the pane that displays the filenames. thus, there is no way to quickly and simply pick these collections of files. the only way (that i currently know of) to see if i'm selecting the right file is to actually randomly select the prefixes for files i'm interested in and load each file individually to inspect them until i'm sure i have the right one. due to teh similar content of the files, even this above method isn't fullproof without additional reading / scrolling once the file is loaded to figure out what file i'm in. basically it's a very time-consuming, inefficient to edit files with long file names in editorial.

    is there a way to "wrap the filenames" or some other setting in editorial so that i can see the full filenames or at least a lot more of each of them in the file browser? switching to landscape doesn't change that width of the file browser pane on my iphone so that's not an option either. am i missing a setting or is there a drop-in replacement that will do what i want?

    thx

    posted in Editorial read more
  • robopu

    hey thanks @mikael. markdownview looks like it has the kind of functionality i'm looking for. i'll have to explore that. i'm coming over from editorial and haven't quite figured out yet what the best way is to download these scripts into pythonista on my iphone. once i do, i'll check this out. thx for the help

    posted in Pythonista read more
  • robopu

    mikael, i'm trying to follow what you're trying to do here. if i wanted to select text in a markdown document, hover over the selection and then use it to "wrap" (ie insert double colons on either end of the text selection which is somewhat similar perhaps to you inserting and maybe toggling a checkbox i think???) the text, would your code be beneficial. i'm not sure i understand what it does ;) thx

    basically i love editorial but there are a few customizations i would like to make that aren't possible so i'm wondering if i might be able to simply "mark" my md documents by baking my own simple md editor in pythonista that only provides the basic extra but stripped-down functionality i need. in sum, i like to highlight specific words and phrases in documents for learning purposes. highlight means toggle on / off wrapping in pairs of my own custom tags. i would also be able to change the default background color for the wrapped pair text.

    i've never done any gui programming before. just trying to get some insights where to start. thx

    posted in Pythonista read more
Internal error.

Oops! Looks like something went wrong!