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

Use subprocess with CREATE_NO_WINDOW flag in ImageShow WindowsViewer #7791

Merged
merged 1 commit into from
Mar 11, 2024

Conversation

radarhere
Copy link
Member

Resolves #7789

The user has found that calling using ImageShow from within a .pyw file on Windows causes a console to appear, as a result of calling os.system from Viewer.

os.system(self.get_command(path, **options)) # nosec

The user has suggested calling subprocess with the CREATE_NO_WINDOW flag to fix this.
https://stackoverflow.com/questions/58943289 / https://stackoverflow.com/a/7006424/4093019 agree with this solution.

Because subprocess.CREATE_NO_WINDOW only exists on Windows, I've added a dedicated WindowsViewer show_file() method for this.

@hugovk hugovk merged commit fc30eba into python-pillow:main Mar 11, 2024
55 of 56 checks passed
@radarhere radarhere deleted the imageshow branch March 12, 2024 00:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Showing an image opens a console
2 participants