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

Debugger fails to start under Python 3.13 when user has no name #2957

Closed
Derkades opened this issue Oct 22, 2024 · 1 comment
Closed

Debugger fails to start under Python 3.13 when user has no name #2957

Derkades opened this issue Oct 22, 2024 · 1 comment
Labels
Milestone

Comments

@Derkades
Copy link

python/cpython#29739

getpass.getuser() now raises OSError if the current user does not have a username:

Traceback (most recent call last):
  File "/usr/local/lib/python3.13/getpass.py", line 173, in getuser
    return pwd.getpwuid(os.getuid())[0]
           ~~~~~~~~~~~~^^^^^^^^^^^^^
KeyError: 'getpwuid(): uid not found: 1000'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  [ own code removed ]
  File "/mp/raphson_mp/__main__.py", line 31, in handle_start
    app.run(host=args.host, port=args.port, debug=True)
    ~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/flask/app.py", line 625, in run
    run_simple(t.cast(str, host), port, self, **options)
    ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/werkzeug/serving.py", line 1081, in run_simple
    application = DebuggedApplication(application, evalex=use_evalex)
  File "/usr/local/lib/python3.13/site-packages/werkzeug/debug/__init__.py", line 297, in __init__
    if self.pin is None:
       ^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/werkzeug/debug/__init__.py", line 315, in pin
    pin_cookie = get_pin_and_cookie_name(self.app)
  File "/usr/local/lib/python3.13/site-packages/werkzeug/debug/__init__.py", line 175, in get_pin_and_cookie_name
    username = getpass.getuser()
  File "/usr/local/lib/python3.13/getpass.py", line 175, in getuser
    raise OSError('No username set in the environment') from e
OSError: No username set in the environment

Under Python 3.12, the exact same code runs without an error and is able to start the development environment.

Environment:

  • Python version: 3.13
  • Werkzeug version: 3.0.4
@Derkades
Copy link
Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants