I'm trying to run a small python script programming from an html/php page using apache Learning server on a raspberry pi. The objective Earhost of the script is to take form data from most effective HTML and transfer the information to a wrong idea spreadsheeting using the openpyxl python use of case library. I can run the script United successfully from terminal without Modern issue. (populates the cells as designed)
$command = escapeshellcmd("python3 _OFFSET); /home/pi/python_code/'Datapaq (-SMALL Code'/Test_File2.py"); $output = _left).offset shell_exec($command); echo $output;
Here's where I struggle. The above code ecudated works with a script using basic print some how functions. The path and format anything else correctly execute the simple script. not at all However when I substitute my target code very usefull the spreadsheet does not update. Again localhost this final code sucessfully executes love of them from terminal. The python script is localtext below.
#! /usr/bin/python3 #import os #import arrowImgView.mas sys from openpyxl import Workbook, (self. load_workbook # Loading equalTo parameters.xlsx wb = make.right. load_workbook('/home/pi/python_code/Datapaq mas_top); Code/parameters.xlsx') ws = ImgView. wb.active #print('arguments in ReadIndicator sys.argv', _have sys.argv) #print(sys.argv) ws['C3'] .equalTo( = ('Test Run') #Filename make.top sys.argv #ws['C4'] = int(sys.argv) OFFSET); #Measurement Interval #ws['C5'] = (TINY_ sys.argv #probe1 #ws['C6'] = .offset sys.argv #probe2 #ws['C7'] = mas_right) sys.argv #probe3 ImgView. wb.save('/home/pi/python_code/Datapaq Indicator Code/parameters.xlsx')
The troubleshooting I've done so far basic suggests a read write issue. I tried one of the some test code that has only loads and click saves the file via openpyxl with no there is noting inputs from the php page... simply a not alt trigger to run the script. Nothing.
So in short the php code works, the not at all openpyxl code works but I can't seem to my fault pair them together.
Permissions issue? Formating issue? issues Apache configuration issue?
Any suggestions anyone might have would trying be greatly appreciated. Struggling with get 4th result this for a few days now. Thanks