rsaim / supplementary

Portal to analyze and visualize results of DTU students.
1 stars 0 forks source link

Stderr from tabula subprocess pollutes output #6

Closed rsaim closed 4 years ago

rsaim commented 4 years ago

This comes from the subprocess:

In [1]: filepath="/Users/saim/github/supplementary/dtu_results/DIS_BT_656_657.pdf"

In [4]: pages_df = tabula.read_pdf(filepath, pages='all')
Got stderr: Jul 30, 2020 4:44:37 AM org.apache.pdfbox.pdmodel.font.PDCIDFontType2 <init>
INFO: OpenType Layout tables used in font ABCDEE+Arial are not implemented in PDFBox and will be ignored
Jul 30, 2020 4:44:37 AM org.apache.pdfbox.pdmodel.font.PDType0Font toUnicode
WARNING: No Unicode mapping for CID+177 (177) in font ABCDEE+Arial
Jul 30, 2020 4:44:37 AM org.apache.pdfbox.pdmodel.font.PDCIDFontType2 <init>
INFO: OpenType Layout tables used in font ABCDEE+Arial are not implemented in PDFBox and will be ignored
Jul 30, 2020 4:44:37 AM org.apache.pdfbox.pdmodel.font.PDType0Font toUnicode
WARNING: No Unicode mapping for CID+177 (177) in font ABCDEE+Arial
Jul 30, 2020 4:44:37 AM org.apache.pdfbox.pdmodel.font.PDCIDFontType2 <init>
INFO: OpenType Layout tables used in font ABCDEE+Arial are not implemented in PDFBox and will be ignored
Jul 30, 2020 4:44:37 AM org.apache.pdfbox.pdmodel.font.PDType0Font toUnicode
WARNING: No Unicode mapping for CID+177 (177) in font ABCDEE+Arial

I have written a context to redirect stderr to /dev/null in a context.

In [2]: from src.python.utils import stderr_redirected

In [3]: with stderr_redirected():
   ...:     pages_df = tabula.read_pdf(filepath, pages='all')
rsaim commented 4 years ago

I added HideUnderlyingStderrCtx.

In [8]: filepath="/Users/saim/github/supplementary/dtu_results/DIS_BT_656_657.pdf"

In [9]: pages_df = tabula.read_pdf(filepath, pages=[5])
Got stderr: Jul 30, 2020 5:04:02 AM org.apache.pdfbox.pdmodel.font.PDCIDFontType2 <init>
INFO: OpenType Layout tables used in font ABCDEE+Arial are not implemented in PDFBox and will be ignored
Jul 30, 2020 5:04:02 AM org.apache.pdfbox.pdmodel.font.PDType0Font toUnicode
WARNING: No Unicode mapping for CID+177 (177) in font ABCDEE+Arial
Jul 30, 2020 5:04:02 AM org.apache.pdfbox.pdmodel.font.PDCIDFontType2 <init>
INFO: OpenType Layout tables used in font ABCDEE+Arial are not implemented in PDFBox and will be ignored
Jul 30, 2020 5:04:02 AM org.apache.pdfbox.pdmodel.font.PDType0Font toUnicode
WARNING: No Unicode mapping for CID+177 (177) in font ABCDEE+Arial
Jul 30, 2020 5:04:02 AM org.apache.pdfbox.pdmodel.font.PDCIDFontType2 <init>
INFO: OpenType Layout tables used in font ABCDEE+Arial are not implemented in PDFBox and will be ignored
Jul 30, 2020 5:04:02 AM org.apache.pdfbox.pdmodel.font.PDType0Font toUnicode
WARNING: No Unicode mapping for CID+177 (177) in font ABCDEE+Arial

In [10]: from src.python.utils import HideUnderlyingStderrCtx

In [11]: with HideUnderlyingStderrCtx():
    ...:     pages_df = tabula.read_pdf(filepath, pages=[5])

Closing this issue.