2

I have a simple python script.

anubhaw.py

#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# enable debugging
import cgitb
import pandas
cgitb.enable()

#print "Content-Type: text/plain;charset=utf-8"
print "Hello World! Trying !!"

I am trying to run it using this method mentioned on SO.

Contents of which are as follows:

<?php 
$command = escapeshellcmd('/home/iamaoxdo/public_html/cgi-bin/anubhaw.py');
$output = shell_exec($command);
echo $output;
//echo file_get_contents("/home/iamaoxdo/public_html/cgi-bin/test2.py");
?>

When am trying to run it on terminal(putty) am getting the output i.e

iamaoxdo@iamanubhaw.com [~/public_html]# php -f python_php.php
Hello World! Trying !!
iamaoxdo@iamanubhaw.com [~/public_html]#

But when am trying to run in web browser (Chrome) it's just giving me a blank screen.

P.S. If I remove the import pandas , am getting the output as "Hello World! Trying !!" but once import pandas is added, it's showing me blank page.

I need pandas as my original script needs this module. I also bought VPS from namecheap for this purpose as python was not running properly on shared server.

Any ideas are welcomed. Thanks.

Community
  • 1
  • 1
driftking9987
  • 1,673
  • 1
  • 32
  • 63

1 Answers1

0

I encountered the seem issue with 'import pandas', or even with 'import openpyxl'. After try - except and print exception information, it turned out that one file of matplotlib was blocking reading by Webuser. Reinstall matplotlib with pip3 resolved my problem.

lvjoe
  • 1