We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
While trying to improve test coverage, I think I found a bug.
$ python -m platform Linux-5.4.0-107-generic-x86_64-with-glibc2.31 $ python -c "import PyPDF2;print(PyPDF2.__version__)" 1.27.5
This is a minimal, complete example that shows the issue:
>>> from PyPDF2 import xmp >>> cls = xmp.XmpInformation >>> cls._converter_date("2021-04-28T12:23:34.123Z") Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/moose/.pyenv/versions/3.10.2/lib/python3.10/site-packages/PyPDF2/xmp.py", line 109, in _converter_date dt = datetime.datetime(year, month, day, hour, minute, seconds, milliseconds) TypeError: 'decimal.Decimal' object cannot be interpreted as an integer
The issue seems to be this line:
second = decimal.Decimal(m.group("second") or "0")
I guess that we can simply convert seconds and milliseconds to float
seconds
milliseconds
The text was updated successfully, but these errors were encountered:
BUG: TypeError in xmp._converter_date
d37e902
Fix: Convert decimal to int before passing it to datetime Closes #774
BUG: TypeError in xmp._converter_date (#813)
63b4c91
BUG: TypeError in xmp._converter_date (py-pdf#813)
4f448b7
Fix: Convert decimal to int before passing it to datetime Closes py-pdf#774
MartinThoma
Successfully merging a pull request may close this issue.
While trying to improve test coverage, I think I found a bug.
Environment
Code
This is a minimal, complete example that shows the issue:
Problem analysis / Fix
The issue seems to be this line:
I guess that we can simply convert
seconds
andmilliseconds
to floatThe text was updated successfully, but these errors were encountered: