pdf2image icon indicating copy to clipboard operation
pdf2image copied to clipboard

OSError while using convert_from_bytes

Open pankhuriagarwal94 opened this issue 6 years ago • 1 comments

Hi,

I am using pdf2image in my application hosted on aws lambda (env python3.6). While I am using convert_from_bytes in my application, it is failing when saving the converted file although file bytes are being loaded into lambda memory.

The stack trace received in logs -

[Errno 14] Bad address: OSError Traceback (most recent call last): File "/opt/python/pdf2image/pdf2image.py", line 158, in convert_from_bytes File "/opt/python/pdf2image/pdf2image.py", line 112, in convert_from_path File "/var/lang/lib/python3.6/subprocess.py", line 863, in communicate File "/var/lang/lib/python3.6/subprocess.py", line 1554, in _communicate data = os.read(key.fd, 32768) OSError: [Errno 14] Bad address

Is there any way to handle such errors ? Any limits? Increasing lambda memory will always be a temporary solution for this problem.

Thanks!

pankhuriagarwal94 avatar Aug 14 '19 06:08 pankhuriagarwal94

My guess would be that it is running out of memory, but you shouldn't be using convert_from_bytes without an output_folder in a memory constrained environment like lambda anyway. See my other repo as an example.

Belval avatar Aug 23 '19 12:08 Belval