You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using SimplePDFViewer to scrape a PDF in an app that has implemented logging and I've discovered that doing so is generating unexpected log statements to stdout.
I created a slightly larger than minimal mvp to illustrate the problem. The attached zip contains the python code testMVP.py and a test pdf, testPartial.pdf.
To see the problem extract both files to the same directory and run the program twice, once with the --pdf flag and once without:
python testMVP.py will run without executing the code on lines 23 & 24, so SimplePDFViewer is not run. The expected result will be:
Be patient - Extracting text & strings from testPartial.pdf
PDF scrapping complete!
Generated file test…
Note that I'm using logging instead of print to generate text output to the console.
python testMVP.py --pdf will run executing lines 23 & 24, so SimplePDFView is run. The unexpected result will be:
Be patient - Extracting text & strings from testPartial.pdf
PDF scrapping complete!
INFO:logTest:PDF scrapping complete!
DEBUG:logTest:doing somethings else…
Generated file test…
INFO:logTest:Generated file test…
You can see that there are 3 logging lines included and the format is clearly different than the stream formatter I setup on line 52 or the file formatter I set up on line 64 of testMVP.py
All the logging works as expected when I don't use SimplePDFViewer, but as soon as I make the call to SimplePDFViewer I'm seeing log messages that for some reason repeat the last message used in a log call. I'm not even seeing the log messages I can see in your code.
I have logging formatters for stdout and a file handler, neither of which matches what is being output only when I call SimplePDFViewer.
As a test I modified the logging of all pdfreader files (17 files had import logging) to connect to the module name logger and the unexpected log messages are not present.
I'm using SimplePDFViewer to scrape a PDF in an app that has implemented logging and I've discovered that doing so is generating unexpected log statements to stdout.
I created a slightly larger than minimal mvp to illustrate the problem. The attached zip contains the python code
testMVP.py
and a test pdf,testPartial.pdf
.To see the problem extract both files to the same directory and run the program twice, once with the
--pdf
flag and once without:python testMVP.py
will run without executing the code on lines 23 & 24, so SimplePDFViewer is not run. The expected result will be:Note that I'm using logging instead of print to generate text output to the console.
python testMVP.py --pdf
will run executing lines 23 & 24, so SimplePDFView is run. The unexpected result will be:You can see that there are 3 logging lines included and the format is clearly different than the stream formatter I setup on line 52 or the file formatter I set up on line 64 of
testMVP.py
Version Information:
testMVP.zip
The text was updated successfully, but these errors were encountered: