F01.justanswer.com



I'm starting over. After looking at your answer, it is obvious I failed to communicate, with the blame being on me. So I'll give this another try. First, I'm working with a Raspberry Pi, so the system is Linux. I have a script “therm.py” which I have downloaded, not modified, and put in “home/pi/Documents”. Using the "terminal" I cd to "home/pi/Documents", and then enter into the Terminal’s command line the following: "Python2 therm.py -help". This results in the following “help” info being displayed in the terminals window:sys.argv()Cooling: -c temperature –t hold_timeHeating: -h temperature –t hold_timeStatus: -sCancel: -xFan: -f [0=auto|1=on]()Example: Set temperature to cool to 80f for 1 hour: Therm.py –c 80 –t 1()If no –t hold_time is provided, it will default to one hour from command time()pi@raspberrypi:~/Documents $For example now, if I want to get the status of my home’s thermostat, I need to enter the following into my terminal’s command line: “python2 therm.py –s”However, I do not want to type into the terminal window’s command line. Rather, I want a python program which I have created, to enter it. I already understand that this can be accomplished by using either the os.system or the subprocess system, but I am not familiar with either of these modules. Apparently, the os.system is no longer recommended to be used. Looking into the subprocess system: it is obvious to me that I am too much of an amature programmer to use it properly. I don’t have the time now to study it. What I so poorly asked, in the beginning, was what line (or lines) of python code do I need to place in my program for it to communicate with the therm.py script directly rather than me typing into the terminal’s command line. All I asked for was one example: instead of me entering into the terminal’s command line: “python2 therm.py –help”, I want to place a line of code in my python program which would look kind of like this: “subprocess.run (python2 therm.py –help)”.I see that I failed miserably to communicate with you in the chat window, perhaps since I was both unfamiliar with the process, and also under pressure. In any case, do you want to pursue this further, or am I wasting your time?Thanks. ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download