Go to advanced search

by beemurt
Sat Jul 20, 2019 11:49 pm
Forum: Python
Topic: Pass PHP Variable to python?
Replies: 7
Views: 311

Re: Pass PHP Variable to python?

Evening/Morning Andy I unfortunately cant use just exec as it hangs up my php while python runs and I need it to all run in the background and not interfere with any other processes. You where right! I have it working now. I had tried so many different things that I had accidentally left in single q...
by beemurt
Sat Jul 20, 2019 9:57 pm
Forum: Python
Topic: Pass PHP Variable to python?
Replies: 7
Views: 311

Re: Pass PHP Variable to python?

Again no Luck!
by beemurt
Sat Jul 20, 2019 9:05 pm
Forum: Python
Topic: Pass PHP Variable to python?
Replies: 7
Views: 311

Re: Pass PHP Variable to python?

Evening Andyroo

Thanks for the reply.

I tried as suggested. No luck. Still the same error.
by beemurt
Sat Jul 20, 2019 8:52 pm
Forum: Python
Topic: Pass PHP Variable to python?
Replies: 7
Views: 311

Pass PHP Variable to python?

Good Evening I am trying to pass a PHP variable into my python script. However I keep getting the following error. Traceback (most recent call last): File "alarmTest.py", line 29, in <module> currUID = int(sys.argv[1]) IndexError: list index out of range My PHP excerpt: $command = system("'python al...
by beemurt
Sat Jul 13, 2019 8:43 pm
Forum: Python
Topic: Subprocessing? Calling and terminating a python script from another python script
Replies: 6
Views: 401

Re: Subprocessing? Calling and terminating a python script from another python script

Evening Paeryn

Your correct, the subrprocess was wrong it should read:

Code: Select all

process = subprocess.Popen('python alarmTest.py', shell=True)
And I think you are right my code inst logically correct either. I will take a look and see if i can fix it up

Thank you
by beemurt
Sat Jul 13, 2019 6:54 pm
Forum: Python
Topic: Subprocessing? Calling and terminating a python script from another python script
Replies: 6
Views: 401

Re: Subprocessing? Calling and terminating a python script from another python script

Unfortunately the continue statements just let the code run in a loop, they dont kill the child script. The code is part of an alarm system. This is the sudo code for what i am trying to do: Check if a device is on the LAN. If it is enter some if statements: if componentsid == 5 and routineAction ==...
by beemurt
Sat Jul 13, 2019 6:11 pm
Forum: Python
Topic: Subprocessing? Calling and terminating a python script from another python script
Replies: 6
Views: 401

Re: Subprocessing? Calling and terminating a python script from another python script

Thank you for the reply MrYsLab I implemented the code you provided and got this response in terminal: Traceback (most recent call last): File "routineDevice.py", line 160, in <module> raise RuntimeError('Proc 1 is None: 1') RuntimeError: Proc 1 is None: 1 The DB is set so that it will hit - if comp...
by beemurt
Sat Jul 13, 2019 5:16 pm
Forum: Python
Topic: Subprocessing? Calling and terminating a python script from another python script
Replies: 6
Views: 401

Subprocessing? Calling and terminating a python script from another python script

Good Afternoon Hopefully someone can help me. I am new-ish to python/programming. I have a script which controls when another script gets called for an alarm system. Basically i want to call tryingToSpawn.py if two vars in a database are set. If two different vars are set I want to kill/terminate tr...
by beemurt
Tue Jul 02, 2019 8:53 am
Forum: Other programming languages
Topic: Execute pkill command for python script using PHP[SOLVED]
Replies: 3
Views: 350

Re: Execute pkill command for python script using PHP[SOLVED]

I have updated this post encase anyone else is struggling with a similar problem. After days of banging my head of a brick wall I finally got it working. It appears I was trying to fix the wrong problem! The issue wasn't that the kill command wasn't working; it was that my python code was hanging up...
by beemurt
Sun Jun 30, 2019 6:32 pm
Forum: Other programming languages
Topic: Execute pkill command for python script using PHP[SOLVED]
Replies: 3
Views: 350

Re: Execute pkill command for python script using PHP

Hi DougieLawson, Thanks for the reply. Security is out of scope for what I am doing so I am not too concerned. www-data is however already in the sudoers file, as below. www-data ALL=(ALL) NOPASSWD: /usr/bin/python www-data ALL=(ALL) NOPASSWD: ALL Yet it appears I still cant run the kill command.
by beemurt
Sun Jun 30, 2019 3:26 pm
Forum: Other programming languages
Topic: Execute pkill command for python script using PHP[SOLVED]
Replies: 3
Views: 350

Execute pkill command for python script using PHP[SOLVED]

Good Afternoon All I have been trying to have PHP execute a pkill command in order to kill a python script which needs to run in a loop. Basically my web page updates a database, and executes a python script. The python script runs based on the updated info in the database. However this is an endles...
by beemurt
Fri Jun 21, 2019 7:27 pm
Forum: Troubleshooting
Topic: RPi3B+ Cant connect to internet
Replies: 4
Views: 477

Re: RPi3B+ Cant connect to internet

Good evening HawaiianPi I think i have fixed this issue, but not found out what caused it. I set up a static address for the eth0 in the dhcpcd file. I am almost certain I didn’t need this before but it appears to be working. I also unplugged my range extender plug and moved it to a different socket...
by beemurt
Fri Jun 21, 2019 4:10 pm
Forum: Troubleshooting
Topic: RPi3B+ Cant connect to internet
Replies: 4
Views: 477

Re: RPi3B+ Cant connect to internet

Hi b.Goode, Thanks for the reply. There are no issues with the network, everything else is running as it should. I have tried restarting the router (a few times) but it didnt help. The ethernet is connect to a range extender plug (it always has been and it has had no problems), plug seems to be work...
by beemurt
Fri Jun 21, 2019 2:51 pm
Forum: Troubleshooting
Topic: RPi3B+ Cant connect to internet
Replies: 4
Views: 477

RPi3B+ Cant connect to internet

Good Afternoon All I have been happily using my pi for a few months with no major issues. Its connected to an ethernet cable. Wifi can be a bit patchy. When I turned the Pi on this morning the time and date where wrong. I corrected this and indeed it may be an urealated issue. However now i cannot c...
by beemurt
Tue May 28, 2019 2:08 pm
Forum: Python
Topic: Cant run python script using php on web browser?
Replies: 2
Views: 906

Re: Cant run python script using php on web browser?

Thank you for the reply Topguy I wasnt aware of the apache errors log. (I am new to linux/raspberry pi) There are a few errors noted. I was able to view the log via: sudo cat /var/log/apache2/error.log in the terminal This issue was nothing to do with my python or php or even the permissions. It was...
by beemurt
Mon May 27, 2019 7:31 pm
Forum: Python
Topic: Cant run python script using php on web browser?
Replies: 2
Views: 906

Cant run python script using php on web browser?

Good Evening I have been trying to make a simple webpage as a GUI to execute my python script(s). Using apache on Pi 3 B+. The script executes in the terminal fine, turning a philips hue bulb on or off. However I cannot get it to exectue from the webpage. The php also writes out to a text file to re...

Go to advanced search