argv emulation for drag and drop not working on OS X 64bit (opendocument events) #1309

Open
matysek opened this Issue Jun 26, 2015 · 16 comments

Projects

None yet

5 participants

@matysek
Member
matysek commented Jun 26, 2015

The bootloader implements argv emulation when the user drag and drops file on the created .app file.

Notes:

  • The implementation uses Carbon framework for this.
  • The implementation works only with 32bit bootloaders.
  • Carbon framework is missing some functions in 64bit environment. Especially the WaitNextEvent.
  • We could either:
    • use other functions from Carbon that are available in Carbon
    • manage events with Cocoa but it would require use objC and probably rewrite some bootloader parts in objC

Resources:

@matysek matysek added this to the PyInstaller 3.0 milestone Jun 26, 2015
@matysek
Member
matysek commented Jun 26, 2015

@dhyams I checked that you dit the original implementation. Do you thing you could look at it or do you have any suggestions how to make argv emulation working for 64bit OS X?

@matysek matysek removed this from the PyInstaller 3.0 milestone Sep 4, 2015
@matysek
Member
matysek commented Sep 4, 2015

This requires a lot of work, removing from PyInstaller 3.0 milestone.

@matysek matysek added this to the PyInstaller 3.x milestone Sep 26, 2015
@matysek matysek changed the title from argv emulation for drag and drop not working on OS X 64bit. to argv emulation for drag and drop not working on OS X 64bit (opendocument events) Sep 26, 2015
@AcidWeb
AcidWeb commented Oct 2, 2015

Lack of this feature also break file association mechanism.

Maybe implementation used by py2app would provide any insight?

@matysek
Member
matysek commented Oct 2, 2015

@AcidWeb Do you have any suggestion how this could be fixed?

@AcidWeb
AcidWeb commented Oct 2, 2015

I don't know OS X well enough to comment this issue.

But I know that py2app approach work on all current OS X releases:
https://bitbucket.org/ronaldoussoren/py2app/src/79e351a5f029f80a2505ed2e2ff7a57a896a1a8f/py2app/bootstrap/argv_emulation.py?at=default&fileviewer=file-view-default

@AcidWeb
AcidWeb commented Oct 3, 2015

I want small clarification. Documentation states:

OpenDocument is the only AppleEvent the bootloader handles. If you want to handle other events, or events that are delivered after the program has launched, you must set up the appropriate handlers.

Handlers in application code or handlers in bootloader code?

@AcidWeb
AcidWeb commented Oct 3, 2015

When I have QT .app created by py2app and already one instance of it is running and I try to open file associated to this application that first instance receive event QtCore.QEvent.FileOpen.

In PyInstaller I got nothing. It is like application don't start at all second time. Sometimes I just got popup with error code -1712.

And I'm not sure if PyInstaller simply require other approach to parse these events or just support for any event parsing is simply broken.

@AcidWeb
AcidWeb commented Oct 3, 2015

PyInstaller spawns a child process as it is bootstrapping the executable, and your Python code runs in this child process. By experimentation, it was found that the AppleEvents never make it to the child process.

OK. This explain much.

So we have two separate problems:

  • Events that are received at application start are not parsed correctly - But approach is correct. They should be converted to argv.
  • Events that are send when application is running don't reach application at all - No idea how handle this.

When you try to start .app that is already running - application is not started at all. OS X just generate event and expect that first instance will parse it.

@giumas
Contributor
giumas commented Oct 20, 2015

@AcidWeb Has there been any progress on the issue? I am hitting the same problem with wxPython

@AcidWeb
AcidWeb commented Oct 20, 2015

I'm not working on this issue.
If you really need it - use py2app.

@giumas
Contributor
giumas commented Oct 24, 2015

@matysek Do you have plan to work on this ticket? I would like to help on solve this issue... but Mac world is quite obscure to me!

@matysek
Member
matysek commented Oct 26, 2015

@giumas not any particular plan yet. The only plan I could think of is doing it similar as py2 app does. It could be helpful if you could find out what from the py2 app principles could be applied to pyinstaller.

@LevN0
LevN0 commented Sep 24, 2016 edited

I too, as apparently are a lot of projects, am waiting on this feature/bug-fix. I hope the maintainers will make it a bigger priority as time allows.

@dhyams
Contributor
dhyams commented Oct 4, 2016

I did the original implementation of argv emulation on OSX for 32-bit. I am not sure what is broken now, but I am getting a Mac very soon, so I do plan to look into it. No guarantees on success or the timetable.

I also don't have any special knowledge on the Mac platform at all; the original implementation was just done just by force of will.

@dhyams
Contributor
dhyams commented Oct 7, 2016

I believe I have a solution for this in a branch. I'm wondering if I can get some volunteers for testing this functionality. It's branch argvemu_osx64 from my fork of the pyinstaller repo.

https://github.com/dhyams/pyinstaller.git

@dhyams
Contributor
dhyams commented Oct 9, 2016

Pull request here: #2219

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment