ncssar / radiolog

SAR radio log program
Other
13 stars 3 forks source link

PyPDF2.errors.DeprecationError prevents clue report print #640

Closed caver456 closed 1 year ago

caver456 commented 1 year ago

Clue dialog stays open; this prevents print and prevents accept of the clue dialog:

070450:generating clue report pdf: C:\Users\caver\RadioLog\New_Incident_2023_03_09_070423\New_Incident_2023_03_09_070423_clue01.pdf
070451:parsed instructions:['asdfasdf']
Traceback (most recent call last):
  File "radiolog.py", line 6663, in accept
  File "radiolog.py", line 3092, in printClueReport
  File "PyPDF2\_reader.py", line 1974, in __init__
  File "PyPDF2\_utils.py", line 369, in deprecation_with_replacement
  File "PyPDF2\_utils.py", line 351, in deprecation
PyPDF2.errors.DeprecationError: PdfFileReader is deprecated and was removed in PyPDF2 3.0.0. Use PdfReader instead.
caver456 commented 1 year ago

Note - this wasn't showing up during development, because I had PyPDF 2.something.something on the development machine, but the build was using PyPDF 3.something.something. Upgraded on the development machine, and can now see the error.

Looks like this is a pitfall of a bit of a sloppy development process. Grownups should make sure they are developing with the same versions of all packages that build uses. What's the best and lowest-impact way to accomplish this - other than doing the tests on the build result as well?

caver456 commented 1 year ago

Next error, after changing to PdfReader:

Traceback (most recent call last):
  File "C:\Users\caver\Documents\GitHub\radiolog\radiolog.py", line 6784, in keyPressEvent
    self.accept()
  File "C:\Users\caver\Documents\GitHub\radiolog\radiolog.py", line 6835, in accept
    self.parent.parent.printClueReport(clueData)
  File "C:\Users\caver\Documents\GitHub\radiolog\radiolog.py", line 3194, in printClueReport
    templatePage=templatePDF.getPage(0)
  File "C:\Users\caver\AppData\Roaming\Python\Python310-32\site-packages\PyPDF2\_reader.py", line 476, in getPage
    deprecation_with_replacement(
  File "C:\Users\caver\AppData\Roaming\Python\Python310-32\site-packages\PyPDF2\_utils.py", line 369, in deprecation_with_replacement
    deprecation(DEPR_MSG_HAPPENED.format(old_name, removed_in, new_name))
  File "C:\Users\caver\AppData\Roaming\Python\Python310-32\site-packages\PyPDF2\_utils.py", line 351, in deprecation
    raise DeprecationError(msg)
PyPDF2.errors.DeprecationError: reader.getPage(pageNumber) is deprecated and was removed in PyPDF2 3.0.0. Use reader.pages[page_number] instead.
caver456 commented 1 year ago

next:

080518:generating clue report pdf: C:\Users\caver\RadioLog\New_Incident_2023_03_09_080505\New_Incident_2023_03_09_080505_clue01.pdf
080518:parsed instructions:['asdf']
Traceback (most recent call last):
  File "C:\Users\caver\Documents\GitHub\radiolog\radiolog.py", line 6835, in accept
    self.parent.parent.printClueReport(clueData)
  File "C:\Users\caver\Documents\GitHub\radiolog\radiolog.py", line 3196, in printClueReport
    templatePage.mergePage(overlayPDF.pages[0])
  File "C:\Users\caver\AppData\Roaming\Python\Python310-32\site-packages\PyPDF2\_page.py", line 693, in mergePage
    deprecation_with_replacement("mergePage", "merge_page", "3.0.0")
  File "C:\Users\caver\AppData\Roaming\Python\Python310-32\site-packages\PyPDF2\_utils.py", line 369, in deprecation_with_replacement
    deprecation(DEPR_MSG_HAPPENED.format(old_name, removed_in, new_name))
  File "C:\Users\caver\AppData\Roaming\Python\Python310-32\site-packages\PyPDF2\_utils.py", line 351, in deprecation
    raise DeprecationError(msg)
PyPDF2.errors.DeprecationError: mergePage is deprecated and was removed in PyPDF2 3.0.0. Use merge_page instead.
caver456 commented 1 year ago

next:

080658:generating clue report pdf: C:\Users\caver\RadioLog\New_Incident_2023_03_09_080644\New_Incident_2023_03_09_080644_clue01.pdf
080658:parsed instructions:['sadf']
Traceback (most recent call last):
  File "C:\Users\caver\Documents\GitHub\radiolog\radiolog.py", line 6784, in keyPressEvent
    self.accept()
  File "C:\Users\caver\Documents\GitHub\radiolog\radiolog.py", line 6835, in accept
    self.parent.parent.printClueReport(clueData)
  File "C:\Users\caver\Documents\GitHub\radiolog\radiolog.py", line 3197, in printClueReport
    outputPDF=PdfFileWriter()
  File "C:\Users\caver\AppData\Roaming\Python\Python310-32\site-packages\PyPDF2\_writer.py", line 2821, in __init__
    deprecation_with_replacement("PdfFileWriter", "PdfWriter", "3.0.0")
  File "C:\Users\caver\AppData\Roaming\Python\Python310-32\site-packages\PyPDF2\_utils.py", line 369, in deprecation_with_replacement
    deprecation(DEPR_MSG_HAPPENED.format(old_name, removed_in, new_name))
  File "C:\Users\caver\AppData\Roaming\Python\Python310-32\site-packages\PyPDF2\_utils.py", line 351, in deprecation
    raise DeprecationError(msg)
PyPDF2.errors.DeprecationError: PdfFileWriter is deprecated and was removed in PyPDF2 3.0.0. Use PdfWriter instead.
caver456 commented 1 year ago

next:

PyPDF2.errors.DeprecationError: addPage is deprecated and was removed in PyPDF2 3.0.0. Use add_page instead.

Ok now it seems to be good. This is definitely worth a hotfix. Will think about whether it should be 3.5.1 or 3.6.0, based on other fixes that have happened on master since 3.5.0, and will install at 91 tonight.