Я создал бот-телеграмму, и он отправляет несколько фотографий пользователю.Хорошо работает на 4 или 5 фотографиях, но после этого вылетает.Я отправляю фотографии так:
for i in range(len(pages)):
photo = open('pics/{0}.jpg'.format(i+1), 'rb')
bot.send_photo(chat_id=chat_id,photo=photo)
это моя ошибка:
2019-03-13 14:30:52,207 (util.py:65 WorkerThread2) ERROR - TeleBot: "MemoryError occurred, args=()
Traceback (most recent call last):
File "/root/Env/pdf/lib/python3.5/site-packages/telebot/util.py", line 59, in run
task(*args, **kwargs)
File "pdf.py", line 63, in handle_docs
pages = convert_from_path('botpdf.pdf', 500)
File "/root/Env/pdf/lib/python3.5/site-packages/pdf2image/pdf2image.py", line 98, in convert_from_path
data, err = proc.communicate()
File "/usr/lib/python3.5/subprocess.py", line 1072, in communicate
stdout, stderr = self._communicate(input, endtime, timeout)
File "/usr/lib/python3.5/subprocess.py", line 1745, in _communicate
stdout = b''.join(stdout)
MemoryError
"
Traceback (most recent call last):
File "pdf.py", line 99, in <module>
bot.polling(none_stop=False, interval=0)
File "/root/Env/pdf/lib/python3.5/site-packages/telebot/__init__.py", line 389, in polling
self.__threaded_polling(none_stop, interval, timeout)
File "/root/Env/pdf/lib/python3.5/site-packages/telebot/__init__.py", line 413, in __threaded_polling
self.worker_pool.raise_exceptions()
File "/root/Env/pdf/lib/python3.5/site-packages/telebot/util.py", line 108, in raise_exceptions
six.reraise(self.exc_info[0], self.exc_info[1], self.exc_info[2])
File "/root/Env/pdf/lib/python3.5/site-packages/six.py", line 693, in reraise
raise value
File "/root/Env/pdf/lib/python3.5/site-packages/telebot/util.py", line 59, in run
task(*args, **kwargs)
File "pdf.py", line 63, in handle_docs
pages = convert_from_path('botpdf.pdf', 500)
File "/root/Env/pdf/lib/python3.5/site-packages/pdf2image/pdf2image.py", line 98, in convert_from_path
data, err = proc.communicate()
File "/usr/lib/python3.5/subprocess.py", line 1072, in communicate
stdout, stderr = self._communicate(input, endtime, timeout)
File "/usr/lib/python3.5/subprocess.py", line 1745, in _communicate
stdout = b''.join(stdout)
MemoryError