Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix pygame.camera backend detection on Windows Server#4221

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
illume merged 1 commit intopygame:mainfromandrigamerita:patch-1
May 15, 2024
Merged

Fix pygame.camera backend detection on Windows Server#4221

illume merged 1 commit intopygame:mainfromandrigamerita:patch-1
May 15, 2024

Conversation

@andrigamerita
Copy link
Contributor

@andrigameritaandrigamerita commentedMay 3, 2024
edited
Loading

The code for pygame.camera backend detection trips when running on a Server variant of modern Windows, causing initialization of the camera system to fail entirely, as can be seen in this traceback generated on my Windows Server 2022 system:

Traceback (most recent call last):  File "<my client program>", line 5, in <module>    pygame.camera.init()  File "[...]\python-3.12.3.amd64\Lib\site-packages\pygame\camera.py", line 168, in init    backends = [b.lower() for b in get_backends()]                                   ^^^^^^^^^^^^^^  File "[...]\python-3.12.3.amd64\Lib\site-packages\pygame\camera.py", line 128, in get_backends    if sys.platform == "win32" and int(platform.win32_ver()[0].split(".")[0]) >= 8:                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ValueError: invalid literal for int() with base 10: '2022Server'

Obviously, Windows Server with the standard desktop environment installed runs the rest of pygame just fine, as it supports webcams at a system level just fine, and this issue has only to do with the version detection code being written without Server in mind.

This commit simply expands the Windows version checking code to make sure that both desktop and Server Windows are handled correctly. I checked how Python returns the Windows version code (_WIN32_SERVER_RELEASES inplatform.py) and my code should handle every possible case. The minimum version check for Windows Server is set at version 2012, as that's equivalent to desktop version 8 as already present in the code before.

illume reacted with thumbs up emoji
The code for pygame.camera backend detection trips when running on a Server variant of modern Windows, causing initialization of the camera system to fail entirely. This commit expands the Windows version checking code to make sure that both desktop and Server Windows are handled correctly.
Copy link
Member

@illumeillume left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

👍 thanks

@illumeillume merged commit9c04fa4 intopygame:mainMay 15, 2024
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@illumeillumeillume approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@andrigamerita@illume

[8]ページ先頭

©2009-2025 Movatter.jp