• mithrendal

    Hi @robnee
    huh, nobody answers to you. Ok I will try. From what I have seen, only breakpoints of the script on which you started the debug-session will fire. That means if you debug a.py only those breakpoints will fire.

    But what seems to work is some sort of multi-module or multiple script debugging. That means if you have your break in a.py then the debugger will perfectly step into b.py when you single step forward and the code leads into a method located in b.py

    posted in Pythonista read more
  • mithrendal

    Weird world. Writing Mac Apps on an iPhone with Pythonista ... How crazy would be that !!! ;-)

    posted in Pythonista read more
  • mithrendal

    @Drizzel I tried my very best to hide my real name but you now uncovered it. Yes I am the son of an uncle of a cousin of gandalf the white! :-)
    PS: hope that they don't throw us out of this forum now. Sorry for the off topic ness nature of this post to anyone who's disturbed by it. :-)

    posted in Pythonista read more
  • mithrendal

    @Drizzel MultipeerConnectivity defines two modes:

    see here the definition taken from apple developer website:

    MCSessionSendDataReliable
    Use this message type for application-critical data.

    MCSessionSendDataUnreliable
    this message type should be used for data that ceases to be relevant if delayed, such as real-time gaming data.

    @mikael uses in his wrapper the first one which might not be perfectly suited for gaming, where you simply want no lag at all. But you can patch the wrapper so it sends in MCSessionSendDataUnreliable mode. just look out for the send data method mikael uses for mode a 0 value. Replace it with a 1 value should do. (https://developer.apple.com/documentation/multipeerconnectivity/mcsessionsenddatamode/1407029-unreliable)

    in mikaels multipeer.py file, find the following line and change the 0 to 1

    self.session.sendData_toPeers_withMode_error_(json.dumps(message).encode(), peers, 0, None)
    

    posted in Pythonista read more
  • mithrendal

    @Drizzel it depends on what you are planning to develop. If you want local multiplayer then forget about the socket stuff and go with multipeer API. If you want multiplayer over the internet then you go the socket way.
    Either way, whish you happy time with sending and receiving data ... it's fun ;-)

    posted in Pythonista read more
  • mithrendal

    @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 ....

    posted in Pythonista read more
  • mithrendal

    Hi,
    if it is ios and macOS only then you could also use the native apple multipeer connectivity API for iOS and macOs.

    Here is a very nice pythonista wrapper which was done by @mikael

    https://github.com/mikaelho/multipeer

    Especially looking up and finding nearby users is very easy with Apples Multipeer Connectivity.

    posted in Pythonista read more
  • mithrendal

    @omz Thank you, that is the solution I was looking for. Now my custom file types can be opened from an iCloud folder from all of my devices.

    I just replaced 'public.data' with 'public.item' as Ole said. With 'public.data' it did not work on an icloud drive on some devices.

    Thank you so much ;-)

    posted in Pythonista read more
  • mithrendal

    hey @cvp your tip was very welcome !! ;-)

    in the meantime I did some testing on more devices and it showed that only one iPhone device had this problem. e.g. it can not select certain files for whatever reason ...

    I did the test on two other devices and there the standard filepicker worked like a charm. I can pick whatever file type I like and read the file into pythonistas memory, even though it does not reside in pythonistas app document space ...

    import dialogs
    
    file = dialogs.pick_document()
    f = open(file,'rb')
    content = f.read() 
    
    

    posted in Pythonista read more
  • mithrendal

    @cvp thank you for your hint. But unfortunately your referenced file picker is not the standard ios file picker. Therefore you can only pick files within the pythonista app itself.

    The one in the dialogs package brings up the iOS system wide file picker and it lets you browse throughout all your apps of your iOS-Device even including your iCloud documents.

    But I can't select some of them. In fact I don't know how to handle the types parameter from dialogs.pick_document() ... The internal pythonista documentation says

    dialogs.pick_document(types=['public.data']) 
    
    Show the system’s document picker for importing a file, and return the file’s path (or None if the dialog is canceled).
    
    types specifies the Universal Type Identifiers (UTIs) that should be selectable in the document picker. 
    The default (['public.data']) makes all regular files selectable. 
    
    A list of the system-defined UTIs are available in Apple’s Uniform Type Identifiers Reference.
    
    The return value is a temporary file. You can read it directly, but to keep a permanent copy, you must move it somewhere else.
    

    Apple has this documentation declaring new type identifiers. But its hard for me to get the clue how that correspondents to the type parameter of dialogs.pick_document(...)

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!