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

Error when starting Python GUI script #2694

Closed
cbrnr opened this issue Nov 13, 2021 · 7 comments
Closed

Error when starting Python GUI script #2694

cbrnr opened this issue Nov 13, 2021 · 7 comments

Comments

@cbrnr
Copy link

cbrnr commented Nov 13, 2021

I get an error when starting a Python GUI script from git-bash (which I believe uses msys2):

Screenshot 2021-11-13 171000

This error does not occur when I start the same script from cmd or powershell.

Steps to Reproduce the Problem

  1. Install Python 3.9.8 for Windows (https://www.python.org/ftp/python/3.9.8/python-3.9.8-amd64.exe)
  2. Install PySide2 with pip install PySide2
  3. Download and unzip the files required for a minimal example: https://github.com/cbrnr/stderr-duplication/archive/refs/heads/main.zip
  4. In a terminal, change into that directory and type pip install .
  5. Type mypackage to run the script and get the error message
@Biswa96
Copy link
Member

Biswa96 commented Nov 13, 2021

@dscho may provide some info.

@dscho
Copy link
Contributor

dscho commented Nov 13, 2021

I have no idea where that is coming from.

@jeremyd2019
Copy link
Member

pypa/pip#10444 but that got closed for no response

@jeremyd2019
Copy link
Member

I do vaguely remember caveats with GetStdHandle in GUI apps. Seems odd that they would only have an issue with stderr though.

@cbrnr
Copy link
Author

cbrnr commented Nov 13, 2021

Thanks @jeremyd2019 for the find! That seems to be the same issue. It is definitely not related to some special install method because I have a package on PyPI that has the same behavior on Bash for Windows. I have also asked on SO but have not received any comments leading to a solution.

@jeremyd2019
Copy link
Member

jeremyd2019 commented Nov 13, 2021

Some observations that may be interesting:

  • all 3 handles (stdin, stdout, stderr) are 0 when GUI app is run from cmd.
  • stdin and stdout are 0 but stderr is non-zero when GUI app is run from MSYS2 from Windows console, but DuplicateHandle fails on this non-zero handle with ERROR_NOT_SUPPORTED.
  • all 3 handles are valid when GUI app is run from MSYS2 mintty.
  • all 3 handles are 0 when GUI app is run via winpty (regardless of Windows console or mintty)
  • enable_pcon option makes no difference.

@cbrnr
Copy link
Author

cbrnr commented Nov 18, 2021

I think this can be closed in favor of pypa/pip#10444; let's continue the discussion over there.

@cbrnr cbrnr closed this as completed Nov 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants