0

I wrote a python script (t.py) to extract text from pdf, and it works as I expected. Then I wrote a PHP (t.php) script to invoke the python script (t.py) by a batch script (t.cmd). And I found python script (t.py) import pdfplumber will disable print text to php (t.php).

Environment version: Windows 11, PHP Version 7.3.4, conda 22.9.0, Python 3.9.12, pdfplumber-0.8.0

The following is the minimal code snippet to reproduce the bug:

t.php:

<?php
$output = shell_exec("t.cmd");
echo $output; # output string 'ok' disappear when t.py import pdfplumber

t.cmd

@echo off
call C:\ProgramData\Miniconda3\Scripts\activate.bat
python.exe D:\t.py

t.py

import pdfplumber

print("ok") # return string 'ok' disappear when import pdfplumber

I tried to upgrade pdfplumber but it doesn't work. How can I use pdfplumber in python script (t.py) and return text to php (t.php)? Thanks in advance.

somggx
  • 43
  • 6

0 Answers0