Community Gallery

Post, download, and share all of your favorite tools and workflows — from Alteryx supported to user-built.
Introducing Alteryx Marketplace

Easily access verified, supported, and secure Add-Ons.

LEARN MORE
Comments
sparksun
11 - Bolide

I got the same error message:

Error: Read in PDF Macro (1): Record #1: Tool #1: Traceback (most recent call last):
File "C:\Users\Admin\AppData\Local\Temp\Engine_14128_05e1b91b86b84666884f2a65e54cfa51_\ae1e474b9392a048514a42c74ef794bb\workbook.py", line 18, in <module>
pdfReader = PyPDF2.PdfFileReader(pdfFileObj)
File "C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\PyPDF2\_reader.py", line 1974, in __init__
deprecation_with_replacement("PdfFileReader", "PdfReader", "3.0.0")
File "C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\PyPDF2\_utils.py", line 369, in deprecation_with_replacement
deprecation(DEPR_MSG_HAPPENED.format(old_name, removed_in, new_name))
File "C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\PyPDF2\_utils.py", line 351, in deprecation
raise DeprecationError(msg)
PyPDF2.errors.DeprecationError: PdfFileReader is deprecated and was removed in PyPDF2 3.0.0. Use PdfReader instead.

 

ck2024
9 - Comet

Hey, I ran the python error through ChatGPT and it corrected it to this which seems to work for me

#################################
# List all non-standard packages to be imported by your
# script here (only missing packages will be installed)
from ayx import Package
Package.installPackages(['pandas','numpy'])


#################################
from ayx import Alteryx
Alteryx.installPackages(package='PyPDF2', install_type="install --user")
import pandas as pd
import PyPDF2


#################################
pdfFileObj = open(Alteryx.read("#1").iloc[0, 0], 'rb')
pdfReader = PyPDF2.PdfReader(pdfFileObj)
pageObj = pdfReader.pages[0] # Updated to use pages[]
page1 = pageObj.extract_text() # Updated to use extract_text()
page1


#################################
page_df = pd.DataFrame([page1])
Alteryx.write(page_df,1)