0

I have used this approach to transfer data between PHP and PYTHON: executing Python script in PHP and exchanging data between the two

The problem I am facing is that python return null whenever I load external libraries. This is the part of my python script

import docx2txt
import re
import os
from odf.opendocument import load
import nltk
import pandas as pd
import csv
'''
some_code_here
'''

I have tested my python script, whenever I load external libraries (like import docx2txt), my python script returns null. I am using python version 3.4 and php version 7.2.1

Mayank
  • 145
  • 1
  • 11
  • I suggest you check the `sys.path` in your python script, python used it to load a module. – DDGG Mar 01 '18 at 06:04
  • for catching the output to `stdout`, you have to use `print` instead of `return` – Sanket Mar 01 '18 at 06:06
  • I have found the solutions. I put all the external libraries in the same directory where python script is stored. After putting all external libraries and python script at one place my python scripts gives output instead of returning null – Mayank Mar 17 '18 at 09:05

0 Answers0