Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello โ I'm @olemoritz on Twitter.
Outliner with drag/drop reordering - part 2
-
@JonB said
Yes, abort. Maybe paired with a notification set for a few seconds in the future to relaunch the app. At least takes that one variable out of the equation!
I like it, thanks
-
@cvp Just to be clear, I only have one copy of the outline.py and, yes ,it is being run from the tab in both cases yet on one iPad it works and the other it fails.
-
@ihf Even with the advices of @JonB , I don't understand this difference...
What I will do, I think, but tomorrow because I have a big request of a neighbor for whom I have programmed also a big program (8248 lines, yours is only 5681), is:
- download from GitHub
- close tab if program runs in a edited tab (to avoid that script end saves the script in the file, replacing the downloaded one)
- abort the program, and thus Pythonista it-self
- try to create a notification for the user, one minute later, to allow him to restart Pythonista and the script (to be tested)
-
@ihf V01.22 and outline.versions with
Version V01.22 - when a new version is available, if user accepts to install it, this version will be installed, then Pythonista will abort to avoid the current edited version to be written and thus replace the new version
This new version only contains thus a supplementary
os.abort()
to force Pythonista to abort and to avoid that current running script, when it ends, saves it-self and thus erases the newly downloaded version. If it works correctly on all your devices, please thanks @JonB for his advice.To test (on all your devices) this, you can wait for the next version, or you can, after manually or automatically having downloaded this version, modify the line
Version = 'V01.22'
into
Version = 'V01.21
and run it, to force the script to believe it is of previous version.
After Pythonista abort, rerun the script and check its version, if it's V01.22, then all is ok.
Of course, I could also generate a notification appearing one minute later asking you to tap it to start Pythonista and the script. Please, tell me if this functionality could help you.
-
@cvp I tested as you suggested on the iPad which was having the problem with downloading the new releases and it worked. Not sure why this works since I had tried (on previous releases) to force quit Pythonista and restart it only to have it try to download the new release again, but happy to have it working now.
-
@ihf said
Not sure why this works since I had tried (on previous releases) to force quit Pythonista and restart it only to have it try to download the new release again
Perhaps did you force quit Pythonista after end of the script, which saves the script on file, even if not changed, it seems.
-
@cvp what is puzzling, but probably not worth pursuing, is why I get different behavior on the two iPads even though Iโm doing exactly the same thing. In any case, it works now.
-
@ihf Life (and my programs ๐) always have a bit of a mystery
-
@ihf do you want a version that, just before the Pythonista abort, creates a local notification which should appear some seconds later. Tapping on this notification will automatically restart outline.py
-
Do some of you use outliner on iPhone?
On my iPhone 12 mini the application crashes when I create new entries continuously. Sooner or later an error appears (see Screenshot).
On my ipad 2020 the Problem does not occur. I use version 1.22.
-
@Bambla Unfortunately, not reproducible. Please, restart Pythonista itself and retry, sorry for you.
-
@Bambla I use outline on my iPhone and iPad all the time. I havenโt seen that problem .
-
@cvp I haven't tested it, but it looks like
https://github.com/andy-landy/traceback_with_variables
Should work with pythonista.This might provide some more useful tracebacks -- that traceback implies that kwargs got stomped on somehow. It could be useful to know what it was stomped with.
-
Thanks for the feedback. As soon as I find out more I will post it here.
-
@Bambla when such a problem occurs, you could check outLine.trace file, perhaps that could help to identify the problem, but not sure at all
-
@JonB said
traceback-with-variables
Be sure that I'm not a Python specialist and thaT I don't understand anything about this traceback, but, promised, I'll try it. Thanks to continue to try to help.
-
@cvp I was deleting a line from an outline (it may have had one child note) and got this:
Traceback (most recent call last): File "/private/var/mobile/Containers/Shared/AppGroup/6CCAAFF1-947E-4DC8-B33B-58EE87A0823C/Pythonista3/Documents/outline.py", line 575, in tableView_heightForRowAtIndexPath_ return tv_py.delegate.tableview_height_for_section_row(tv_py,section,row) File "/private/var/mobile/Containers/Shared/AppGroup/6CCAAFF1-947E-4DC8-B33B-58EE87A0823C/Pythonista3/Documents/outline.py", line 1250, in tableview_height_for_section_row vals,n,opts = tv.data_source.items[row]['content'] IndexError: list index out of range Traceback (most recent call last): File "/private/var/mobile/Containers/Shared/AppGroup/6CCAAFF1-947E-4DC8-B33B-58EE87A0823C/Pythonista3/Documents/outline.py", line 575, in tableView_heightForRowAtIndexPath_ return tv_py.delegate.tableview_height_for_section_row(tv_py,section,row) File "/private/var/mobile/Containers/Shared/AppGroup/6CCAAFF1-947E-4DC8-B33B-58EE87A0823C/Pythonista3/Documents/outline.py", line 1250, in tableview_height_for_section_row vals,n,opts = tv.data_source.items[row]['content'] IndexError: list index out of range Traceback (most recent call last): File "/private/var/mobile/Containers/Shared/AppGroup/6CCAAFF1-947E-4DC8-B33B-58EE87A0823C/Pythonista3/Documents/outline.py", line 2928, in tableview_cell_for_row hrow = self.tableview_height_for_section_row(tableview,section,row) File "/private/var/mobile/Containers/Shared/AppGroup/6CCAAFF1-947E-4DC8-B33B-58EE87A0823C/Pythonista3/Documents/outline.py", line 1250, in tableview_height_for_section_row vals,n,opts = tv.data_source.items[row]['content'] IndexError: list index out of range
-
-
Software development is just plain hard!!!
File "/private/var/mobile/Containers/Shared/AppGroup/6CCAAFF1-947E-4DC8-B33B-58EE87A0823C/Pythonista3/Documents/outline.py", line 1250, in tableview_height_for_section_row vals,n,opts = tv.data_source.items[row]['content'] IndexError: list index out of range
Here is what I would do... Go to line 1250 and see if you can make this change.
vals,n,opts = tv.data_source.items[row]['content'] # --> try: vals,n,opts = tv.data_source.items[row]['content'] except IndexError: print(f"{row = } but {len(tv.data_source.items) = }") raise
This should show you that
row
is off the end of the data source.Then look for all the places where
tableView_heightForRowAtIndexPath_()
is called and wrap them also:try: tableView_heightForRowAtIndexPath_(x, y, z, path) except IndexError: print(f"{path = }") raise
Keep the code between the
try
andexcept
as few lines as possible.Avoid like the plague that it is
try:
somethingexcept:
pass
. -
@ccc said
Software development is just plain hard!!!
Believe me, I know it, I personally have developed in a lot of programming languages during 40 years before I meet Python(ista).
I'll try your code, but I'm no more motivated because sometimes error come from ObjectiveC usage and I don't have access to what it does.รdit: That's what I said, this tableView_heightForRowAtIndexPath_() is never called by my code but by ObjectiveC code (I use @JonB 's swizzle for That).
Thus the error is not so obvious. Personally, I think that the error comes from the ObjectiveC calls.