Skip to content
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

mailbagit-gui command not running on Windows #155

Open
gwiedeman opened this issue May 2, 2022 · 3 comments
Open

mailbagit-gui command not running on Windows #155

gwiedeman opened this issue May 2, 2022 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@gwiedeman
Copy link
Collaborator

gwiedeman commented May 2, 2022

Describe the bug
While #147 addressed most of the remaining GUI issues mentioned in #76, the mailbagit-gui command as defined as an entry point in setup.py does not fully run in Windows. It opens the GUI window and allows you to fill out the fields, but once you try and run it it returns:

c:\users\greg\appdata\local\programs\python\python37-32\python.exe: can't open file 'C:\Users\Greg\.virtualenvs\mailbag-_Z7D2G4R\Scripts\mailbagit-gui': [Errno 2] No such file or directory

This example is using a virtualenv managed by pipenv, but the same thing happens using the system python. There is a mailbagit-gui.exe file located in that directory and I think that's what's being called when you first run the mailbagit-gui command. If I just run C:\Users\gw234478\.virtualenvs\mailbag-wl96s53w\Scripts\mailbagit-gui it does load the GUI window (even outside of the virtualenv). I think its running python path/to/mailbagit-gui which tries and fails to run the exe.

There is also a mailbagit-gui-script.py file in the scripts directory that appears to run the exe? Running this directly also fails with the same result.

This does not happen on Ubuntu 20.04 so it appears to be limited to Windows. Looks like the entry_point for ubuntu is a Python script instead of an .exe, which explains why it runs fine with python mailbagit-gui but Windows does not. This makes me think its a Gooey bug not handling or supporting entry points on Windows because of this.

gui-error

To Reproduce
Steps to reproduce the behavior:

  1. enter the command mailbagit-gui
  2. fill out the options in the GUI
  3. Click "Start"

Expected behavior
After you click "Start" it should package the file(s) provided into a mailbag.

Environment (please complete the following information):

  • GUI or command line?: GUI
  • OS: Win10
  • Python version: multiple but using 3.9.12 right now.

Additional context
Works fine from the mailbagit-gui.py script which just runs mailbagit.gui(). This is used to build the executable so that path works fine.

@gwiedeman gwiedeman added the bug Something isn't working label May 2, 2022
@gwiedeman
Copy link
Collaborator Author

Looks like this is Gooey issue #649.

@pobocks
Copy link
Collaborator

pobocks commented May 10, 2022

Looked this over and concur - don't think we can meaningfully fix this on our end, we'd need to fix it and submit upstream.

@dominikandreas
Copy link

dominikandreas commented Oct 30, 2022

Also ran into this problem. I've come up with a workaround and an idea for a permanent fix.

Workaround:
In the module / function being executed by your script, insert something like this:

if not os.path.isfile(sys.argv[0]):
    exit(os.system(f"{sys.executable} -m <python module> {' '.join(sys.argv[1:]}"))

i.e. in your case this could be (not tested):

import sys
if gooeyCheck:

    @Gooey(richtext_controls=True)
    def gui():
        """hook for GUI mailbagit invocation"""
        if not os.path.isfile(sys.argv[0]):
            exit(os.system(f"{sys.executable} -m mailbagit.gui  {' '.join(sys.argv[1:]}"))
        args = mailbag_parser.parse_args()
        main(args)

Idea for permanent fix

  • check sys.argv[1] does not exist
  • if yes, execute the corresponding exe file instead of python {sys.argv[1]}

Unfortunately I don't have the time to implement this and create a PR in gooey at this time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

No branches or pull requests

3 participants