Error Importing pillow python package into TestComplete
I am trying to import pillow python package to read images from a PDF file. I am getting below error
Python runtime error.
ImportError: cannot import name '_imaging' from 'PIL' (C:\Program Files (x86)\SmartBear\TestComplete 15\Bin\Extensions\Python\Python310\Lib\PIL\__init__.py)
Below is the script I am trying to run
from PIL import Image, ImageFilter
import PyPDF2
from PyPDF2 import PdfReader
def pdfimages():
reader = PdfReader("C:\\GitHub Repo\\AE_QE_CommonAutomationFramework_UI\\UI_Automation\\TestData\\The Anatomy of a Breach.pdf")
page = reader.pages[0]
count = 0
for image_file_object in page.images:
with open(str(count) + image_file_object.name, "wb") as fp:
fp.write(image_file_object.data)
count += 1
Log.Message(count)
I have tried importing packages into "C:\Program Files (x86)\SmartBear\TestComplete 15\Bin\Extensions\Python\Python310\Lib" folder and also tried referencing packages directly from python packages using below. I don't have any issues with pypdf package.
from os import sys
sys.path.insert(0, "C:\\Python312\\Lib\\site-packages")
Any help here is greatly appreciated! thanks!