Pdfplumber reports an error when reading PDF table attributeerror: function/symbol ‘arc4_stream_init’ not found in library
Solutions to errors reported
Error reporting item
When using pdfplumber to extract tables in PDF, you will be prompted that arc4 is missing_stream_init。
Traceback (most recent call last):
File "C:\Users\Stan\Python\ALIRT\pdf extracter\test.py", line 50, in <module>
text = convert_pdf_to_txt('test_pdf.pdf')
File "C:\Users\Stan\Python\ALIRT\pdf extracter\test.py", line 40, in convert_pdf_to_txt
for page in PDFPage.get_pages(fp, pagenos, maxpages=maxpages, password=password,caching=caching, check_extractable=True):
File "C:\Users\Stan\anaconda3\lib\site-packages\pdfminer\pdfpage.py", line 127, in get_pages
doc = PDFDocument(parser, password=password, caching=caching)
File "C:\Users\Stan\anaconda3\lib\site-packages\pdfminer\pdfdocument.py", line 564, in __init__
self._initialize_password(password)
File "C:\Users\Stan\anaconda3\lib\site-packages\pdfminer\pdfdocument.py", line 590, in _initialize_password
handler = factory(docid, param, password)
File "C:\Users\Stan\anaconda3\lib\site-packages\pdfminer\pdfdocument.py", line 283, in __init__
self.init()
File "C:\Users\Stan\anaconda3\lib\site-packages\pdfminer\pdfdocument.py", line 291, in init
self.init_key()
File "C:\Users\Stan\anaconda3\lib\site-packages\pdfminer\pdfdocument.py", line 304, in init_key
self.key = self.authenticate(self.password)
File "C:\Users\Stan\anaconda3\lib\site-packages\pdfminer\pdfdocument.py", line 354, in authenticate
key = self.authenticate_user_password(password)
File "C:\Users\Stan\anaconda3\lib\site-packages\pdfminer\pdfdocument.py", line 361, in authenticate_user_password
if self.verify_encryption_key(key):
File "C:\Users\Stan\anaconda3\lib\site-packages\pdfminer\pdfdocument.py", line 368, in verify_encryption_key
u = self.compute_u(key)
File "C:\Users\Stan\anaconda3\lib\site-packages\pdfminer\pdfdocument.py", line 326, in compute_u
result = ARC4.new(key).encrypt(hash.digest()) # 4
File "C:\Users\Stan\anaconda3\lib\site-packages\Crypto\Cipher\ARC4.py", line 132, in new
return ARC4Cipher(key, *args, **kwargs)
File "C:\Users\Stan\anaconda3\lib\site-packages\Crypto\Cipher\ARC4.py", line 60, in __init__
result = _raw_arc4_lib.ARC4_stream_init(c_uint8_ptr(key),
File "C:\Users\Stan\anaconda3\lib\site-packages\cffi\api.py", line 912, in __getattr__
make_accessor(name)
File "C:\Users\Stan\anaconda3\lib\site-packages\cffi\api.py", line 908, in make_accessor
accessors[name](name)
File "C:\Users\Stan\anaconda3\lib\site-packages\cffi\api.py", line 838, in accessor_function
value = backendlib.load_function(BType, name)
AttributeError: function/symbol 'ARC4_stream_init' not found in library 'C:\Users\Stan\anaconda3\lib\site-packages\Crypto\Util\..\Cipher\_ARC4.cp37-win_amd64.pyd': error 0x7f
Solution:
Downgrade:
pip install pycryptodome==3.0.0
Two methods
Method 1:
# Installation
$ pip install arc4
# Import ARC4 package
from arc4 import ARC4
Method 2:
# Installation
$ pip install crypto
# Import ARC4 package
from Crypto.Cipher import ARC4
Read More:
- [Solved] error: (-2:Unspecified error) The function is not implemented. Rebuild the library with Windows
- AttributeError: lower not found (NLP extracted tfidf features)
- TensorFlow Install Error: Could not load dynamic library ‘*****.dll‘; dlerror: ********.dll not found
- [Mac Pro M1] Python3.9 import cv2 Error: Reason: image not found
- [Solved] ansible Command Error: Error -5 while decompressing data: incomplete or truncated stream
- [Solved] mnn Import Error: initMNN: init numpy failed
- [Solved] Paramiko error: AttributeError: ‘NoneType’ object has no attribute ‘time’
- [Solved] ParserError: NULL byte detected. This byte cannot be processed in Python‘s native csv library
- import statsmodels.api as sm Error: ImportError: DLL load failed while importing _arpack: The specified program could not be found.
- [Solved] AttributeError: module ‘distutils‘ has no attribute ‘version‘
- [leetcode] 295. Find Median from Data Stream Python
- Import win32API; importerror: DLL load failed: the specified program was not found
- FileNotFoundError: Could not find module ‘D:\Anaconda3\envs\labe\Library\bin\geos_c.dll‘ [Solved]
- Python: How to Auto Add Watermark to PDF
- [Solved] AttributeError: module ‘logging‘ has no attribute ‘Handler‘
- Python+Selenium Error: AttributeError: ‘WebDriver‘ NameError: name ‘By‘ is not defined
- [Solved] Python Image Library fails with message “decoder JPEG not available” – PIL
- AttributeError: can‘t set attribute [How to Solve]
- [Solved] HTTPError: 404 Client Error: Not Found for url: https://huggingface.co/saved_model
- [Solved] RuntimeError: No application found. Either work inside a view function or push an application contex