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

DeprecationWarning in Python 3.12 #19

Open
benoit74 opened this issue Mar 1, 2024 · 0 comments
Open

DeprecationWarning in Python 3.12 #19

benoit74 opened this issue Mar 1, 2024 · 0 comments

Comments

@benoit74
Copy link

benoit74 commented Mar 1, 2024

There is two DeprecationWarning in Python 3.12.

pyamf/util/__init__.py:217: DeprecationWarning: datetime.datetime.utcfromtimestamp() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.fromtimestamp(timestamp, datetime.UTC).
    datetime.datetime.utcfromtimestamp(-31536000.0)
pyamf/adapters/__init__.py:44
  /home/benoit/Repos/openzim/warc2zim/.hatch/warc2zim/lib/python3.12/site-packages/pyamf/adapters/__init__.py:44: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
    import pkg_resources

First one is probably minor to fix.

Second one is kind of a blocker for Python 3.12, but there is a fallback in the code, so it probably still works in most situations.

The second one can probably easily be fixed with https://docs.python.org/3/library/importlib.resources.html with something like this:

try:
    from importlib import resources
    ....
except:
  try:
    import pkg_resources
    packageDir = pkg_resources.resource_filename('pyamf', 'adapters')
  except:
    packageDir = os.path.dirname(__file__)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant