New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

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

This comment has been minimized.

Show comment
Hide comment
@matysek

matysek Jun 26, 2015

Member

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

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

This comment has been minimized.

Show comment
Hide comment
@matysek

matysek Sep 4, 2015

Member

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

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

This comment has been minimized.

Show comment
Hide comment
@AcidWeb

AcidWeb Oct 2, 2015

Lack of this feature also break file association mechanism.

Maybe implementation used by py2app would provide any insight?

AcidWeb commented Oct 2, 2015

Lack of this feature also break file association mechanism.

Maybe implementation used by py2app would provide any insight?

@matysek

This comment has been minimized.

Show comment
Hide comment
@matysek

matysek Oct 2, 2015

Member

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

Member

matysek commented Oct 2, 2015

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

@AcidWeb

This comment has been minimized.

Show comment
Hide comment
@AcidWeb

AcidWeb 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 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

This comment has been minimized.

Show comment
Hide comment
@AcidWeb

AcidWeb 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 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

This comment has been minimized.

Show comment
Hide comment
@AcidWeb

AcidWeb 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 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

This comment has been minimized.

Show comment
Hide comment
@AcidWeb

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

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

This comment has been minimized.

Show comment
Hide comment
@giumas

giumas Oct 20, 2015

Contributor

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

Contributor

giumas commented Oct 20, 2015

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

@AcidWeb

This comment has been minimized.

Show comment
Hide comment
@AcidWeb

AcidWeb Oct 20, 2015

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

AcidWeb commented Oct 20, 2015

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

@giumas

This comment has been minimized.

Show comment
Hide comment
@giumas

giumas Oct 24, 2015

Contributor

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

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

This comment has been minimized.

Show comment
Hide comment
@matysek

matysek Oct 26, 2015

Member

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

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

This comment has been minimized.

Show comment
Hide comment
@LevN0

LevN0 Sep 24, 2016

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.

LevN0 commented Sep 24, 2016

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

This comment has been minimized.

Show comment
Hide comment
@dhyams

dhyams Oct 4, 2016

Contributor

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.

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

This comment has been minimized.

Show comment
Hide comment
@dhyams

dhyams Oct 7, 2016

Contributor

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

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

This comment has been minimized.

Show comment
Hide comment
@dhyams

dhyams Oct 9, 2016

Contributor

Pull request here: #2219

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