@Blanchot So true.
@mikael your new job colleagues will be very happy as they get a high skilled and very talented work mate with you!!! Wish you a happy time on your new journey.
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.
@Blanchot So true.
@mikael your new job colleagues will be very happy as they get a high skilled and very talented work mate with you!!! Wish you a happy time on your new journey.
Hello Ole,
I am back on the app store version again. Why not just release the last beta to the app store? It was pretty stable. Come on don't be shy and just push the button !
;-)
I like the intuitive and simplistic API approach as always when mikael comes out with a new thing ;-) Next time I have a need for parallel execution in my code I will definitly come back to genr ...
the beta expired. I did not delete it ! I just reinstalled the old appstore version. After the download completed, now pythonista starts again. All my data was still there.
Hi @Lacajenne
Is it one of the new iPads Pros with bigger screens ? When I remember correctly the current version on the app store is not so compatible with the new screen sizes from the new iPads. A new beta version is already available since late december which fixes this. You could download it, just watch out for the thread about the new Pythonista 3.3 BETA or you have to wait and have a bit patience it should be out sometime soon.
you could setup a custom view and overwrite the will_close method, maybe you also like to know when the view is fully loaded...
I have copied the appropiate code from the docs http://omz-software.com/pythonista/docs/ios/ui.html for you
import ui
class MyView (ui.View):
def did_load(self):
# This will be called when a view has been fully loaded from a UI file.
pass
def will_close(self):
# This will be called when a presented view is about to be dismissed.
# You might want to save data here.
pass
@ccc the last line does not close the server socket itself. It only closes the just accepted connection. The client also closes immediately after sending "some data". So no reason to not close the connection on server side.
Anyway @bennr01 did only write this as some short demonstration ... In real world you would probably hold the connection open over the whole game session ....
Hi @mikael,
Yes that looks promising. I just uploaded my work on this for you at github. It doesn't crash and is completely reentrant. The idea was to make an simple API which games and other apps can import. But I did not work on it recently. When I saw your post that you too want to build an API I thought you might want to have a look. https://github.com/mithrendal/pythonista_mpc
Btw I am a big fan of your Gestures.py API 😀
Hi Mikael,
had the same problem. The crash was caused by the garbage collection which is triggered automatically somewhen when python wants to delete the invitationHandler.
My approach/workaround was not to get it deleted by remembering its reference. That way the garbage collector will not call delete on it.
instead of
blk.invoke(ObjCInstance(invitationHandler),True, ObjCInstance(mySession))
try
inviHandler = ObjCInstance(invitationHandler)
someglobalscopeobject.remember_this_thing=inviHandler
blk.invoke(inviHandler,True, ObjCInstance(mySession))
my guess was that something in the MPC framework still holds the reference and uses this invitation handler but the pythonista garbage collector does not know this because it only knows about references in your python programm. Thus when the python gc deletes it, and after that something in the apple mpc framework wants to call it, it will inevitably crash.
EDIT:
instead of someglobalscopedobject you could also use something like that to make it able to be reentrant
import builtins
...
inviHandlerObj = ObjCInstance(invitationHandler)
if (builtins.retainCache == NONE):
builtins.retainCache = [ ]
builtins.retainCache.append(inviHandlerObj)
blk.invoke(inviHandlerObj,True, ObjCInstance(mySession))
...
@Blanchot So true.
@mikael your new job colleagues will be very happy as they get a high skilled and very talented work mate with you!!! Wish you a happy time on your new journey.
Hello Ole,
I am back on the app store version again. Why not just release the last beta to the app store? It was pretty stable. Come on don't be shy and just push the button !
;-)
I like the intuitive and simplistic API approach as always when mikael comes out with a new thing ;-) Next time I have a need for parallel execution in my code I will definitly come back to genr ...
I understand that seems plausible. Then we have got this bug because @omz built the 330018 with a new version of XCode ... Do you think he should apply for an exception to the rule as pointed out in your linked article then ? Maybe Apple won't give him and us this exception...
the official example still works with the 330015 and with the appstore version on iOS13.2. Therefore definitly a new problem introduced with 330018.
the example from the official documentation http://omz-software.com/pythonista/docs/ios/contacts.html
does not work anymore in this build. It just stops on line 6 without an error.
The problem is the access to the "note" property.
import contacts
print('Address Book Notes')
print('=' * 40)
people = contacts.get_all_people()
for p in people:
note = p.note
if note:
print(p.full_name)
print('-' * 40)
print(note)
print('=' * 40)
the following version without access to the contact notes work as in the older builds... so it has nothing todo with permissions to the contacts in general...
import contacts
print('Address Book Notes')
print('=' * 40)
people = contacts.get_all_people()
for p in people:
print(p.full_name)
print('-' * 40)
print('=' * 40)
You could also use apples MFMessageComposeViewController. With that your program can automatically create a encoded message and put that onto apple messages to a receipient of your choice. The base64 encoded message databody should be prefixed with pythonista://nameofyourpyprogram?action=run&args=.... So that the Receiver just taps on the incoming message and jumps into your app. I wrote a mini tictoc app for fun which uses this method to asynchronously play with a friend. if you tell me that you want to go that direction, I could upload the example to github for you.
If you do not see the iCloud Symbol in pythonista under
Script Library
or if your iCloud drive does not contain a folder for pythonista when you want to setup the sync in working copy.
Then just head over to the ios settings and choose iCloud and enable pythonista to be able to use the iCloud.
Until iOS13 you could simply open the working copy folder in pythonista as an external folder. This is not possible in iOS 13 with the current version of pythonisa since apple altered the document picker API for folders. See the two threads https://forum.omz-software.com/topic/5817/can-t-add-external-folder-from-working-copy-via-files-app-folders-are-not-selectable-all-folders-inside-files-app-popup and https://forum.omz-software.com/topic/5843/ios-13 for a temporary solution ... We hope that the developer @omz will adapt the new release which is currently in the beta for that new iOS13 documentpicker folder API though.