Skip to content

Error on multiprocessing.log_to_stderr(level=None) #115461

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

Closed
arthursw opened this issue Feb 14, 2024 · 2 comments
Closed

Error on multiprocessing.log_to_stderr(level=None) #115461

arthursw opened this issue Feb 14, 2024 · 2 comments
Labels
type-bug An unexpected behavior, bug, or error

Comments

@arthursw
Copy link

arthursw commented Feb 14, 2024

Bug report

Bug description:

The function multiprocessing.log_to_stderr() throws an error:

Python 3.10.13 (main, Sep 11 2023, 08:16:02) [Clang 14.0.6 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import multiprocessing
>>> logger = multiprocessing.log_to_stderr()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/amasson/micromamba/envs/nf_cloud/lib/python3.10/multiprocessing/context.py", line 162, in log_to_stderr
    return log_to_stderr(level)
  File "/Users/amasson/micromamba/envs/nf_cloud/lib/python3.10/multiprocessing/util.py", line 94, in log_to_stderr
    logger = get_logger()
  File "/Users/amasson/micromamba/envs/nf_cloud/lib/python3.10/multiprocessing/util.py", line 67, in get_logger
    logging._acquireLock()
AttributeError: module 'logging' has no attribute '_acquireLock'
>>> 

Same thing with Python 12.0:

Python 3.12.0 (v3.12.0:0fb18b02c8, Oct  2 2023, 09:45:56) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import multiprocessing
>>> logger = multiprocessing.log_to_stderr()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/context.py", line 162, in log_to_stderr
    return log_to_stderr(level)
           ^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/util.py", line 94, in log_to_stderr
    logger = get_logger()
             ^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/util.py", line 67, in get_logger
    logging._acquireLock()
    ^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'logging' has no attribute '_acquireLock'

CPython versions tested on:

3.10, 3.12

Operating systems tested on:

macOS

@arthursw arthursw added the type-bug An unexpected behavior, bug, or error label Feb 14, 2024
@brianschubert
Copy link
Contributor

Do you have another module named logging somewhere that's shadowing the stdlib module? What is the output of

>>> import logging
>>> print(logging)

?

It seems unlikely to be related, but logging._acquireLock was removed in gh-109462. Any chance those environments have been corrupted with 3.13 alpha files?

@arthursw
Copy link
Author

Ah yes, you're right!

>>> print(logging)
<module 'logging' from '/Users/amasson/Travail/nf-cloud/worker/src/nf_cloud_worker/logging/__init__.py'>

Sorry about that, I should have tried on another machine.

@terryjreedy terryjreedy closed this as not planned Won't fix, can't repro, duplicate, stale Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

3 participants