How to close pyPDF “PdfFileReader” Class file handle

前端 未结 4 1013
青春惊慌失措
青春惊慌失措 2021-01-12 01:12

this should be very simple question, for which I couldn\'t find answer by Google search: How to close file handle opened by pyPDF \"PdfFileReader\" Class

Here is sni

4条回答
  •  佛祖请我去吃肉
    2021-01-12 02:00

    instead using input=PdfFileReader(file(fname, "rb")) create an input stream like this

    inputStream=file(fname, "rb")
        input=PdfFileReader(inputStream)
    

    and when job is done use inputStream.close() then u will be able to call it through os package

提交回复
热议问题