ronaldoussoren/py2app

Finder and "open with"

Opened this issue · 1 comments

I am having the same problem trying to figure out what this guy on stack overflow asks:

https://stackoverflow.com/questions/73145905/how-to-receive-file-when-file-is-opened-in-python

Looked through Apple's plist documentation did not find any keys to help.

I've posted an answer to that question, which is close to impossible to answer there due to lack of information.

In short, opening files in macOS by double clicking or dropping a file on the application icon results in a file open event (AppleEvents) that the application needs to handle. Most GUI libraries have a way convert those events into their regular event handling code.

You appear to be using wxWidgets, and that has some documentation on how to do this: https://wiki.wxwidgets.org/WxMac-specific_topics#File_associations. That package is targeting C++ code, but I expect that something similar can be done in Python code.