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

locale.getdefaultlocale is deprecated #1238

Open
graingert-coef opened this issue Dec 12, 2023 · 3 comments
Open

locale.getdefaultlocale is deprecated #1238

graingert-coef opened this issue Dec 12, 2023 · 3 comments
Labels

Comments

@graingert-coef
Copy link

getdefaultlocale is called here:

'ai.device.locale': locale.getdefaultlocale()[0],

and results in a deprecation warning:

Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/logging/config.py", line 573, in configure
    handler = self.configure_handler(handlers[name])
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/logging/config.py", line 735, in configure_handler
    klass = self.resolve(cname)
            ^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/logging/config.py", line 402, in resolve
    self.importer(used)
  File "/home/vsts/work/1/s/venv/lib/python3.11/site-packages/opencensus/ext/azure/log_exporter/__init__.py", line 22, in <module>
    from opencensus.ext.azure.common import Options, utils
  File "/home/vsts/work/1/s/venv/lib/python3.11/site-packages/opencensus/ext/azure/common/utils.py", line 30, in <module>
    'ai.device.locale': locale.getdefaultlocale()[0],
                        ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/locale.py", line 559, in getdefaultlocale
    warnings._deprecated(
  File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/warnings.py", line 514, in _deprecated
    warn(msg, DeprecationWarning, stacklevel=3)
DeprecationWarning: 'locale.getdefaultlocale' is deprecated and slated for removal in Python 3.15. Use setlocale(), getencoding() and getlocale() instead.
@graingert-coef
Copy link
Author

see also python/cpython#90817

@lzchen
Copy link
Contributor

lzchen commented Dec 12, 2023

@graingert-coef

Do you see this warning on Python 3.9? OpenCensus only supports up to Python 3.9

@graingert-coef
Copy link
Author

@lzchen I'm using this on Python 3.11

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