Python Noob Question.

O

Owatch

Sorry, but I was redirected here via a thread on another forum concerning where to find help for Python. (Python-forums.org not working for me)

I wanted to ask if there was any way I could write a simple Python Temperature program. Where essentially it somehow (Now sure how, I'm a noob remember) read temps off of windows (Providing windows records cpu temps) from their program and then rang an alarm if temperatures exceeded a certain value.

I can write the part about the alarm going off. But I have no idea how to have it stream or update values it would grab from that program (whatever itmight be).

Could you please help, or tell me if its possible.
Thanks, Owatch.
 
S

Steven D'Aprano

Sorry, but I was redirected here via a thread on another forum
concerning where to find help for Python. (Python-forums.org not working
for me)

I wanted to ask if there was any way I could write a simple Python
Temperature program. Where essentially it somehow (Now sure how, I'm a
noob remember) read temps off of windows (Providing windows records cpu
temps) from their program and then rang an alarm if temperatures
exceeded a certain value.

I can write the part about the alarm going off. But I have no idea how
to have it stream or update values it would grab from that program
(whatever it might be).

Could you please help, or tell me if its possible. Thanks, Owatch.

Yes, it's possible, but if you have no idea which program you want to
read temperature data from, what makes you think we would have any better
idea? This is a Python forum, not a "Windows programs that give
temperature data" forum.

I recommend you start by doing some research into how to read the
temperature data, including the name of the program. Once you have that,
come back to us for help in using Python.
 
D

Dennis Lee Bieber

I wanted to ask if there was any way I could write a simple Python Temperature program. Where essentially it somehow (Now sure how, I'm a noob remember) read temps off of windows (Providing windows records cpu temps) from their program and then rang an alarm if temperatures exceeded a certain value.

Reading values from the CPU requires accessing the OS specific means
of obtaining that data -- this is likely going to be the same method for
all programming languages used on /that/ OS (so all Windows programs
would use the same method, but if you go to a Linux system you have to
rewrite the part that reads the temperatures).

http://social.msdn.microsoft.com/forums/en-US/netfxbcl/thread/34f0fa55-567b-4a98-a29d-b92a5c9b5f8f/

http://stackoverflow.com/questions/3262603/accessing-cpu-temperature-in-python
 
O

Owatch

Yes, it's possible, but if you have no idea which program you want to

read temperature data from, what makes you think we would have any better

idea? This is a Python forum, not a "Windows programs that give

temperature data" forum.



I recommend you start by doing some research into how to read the

temperature data, including the name of the program. Once you have that,

come back to us for help in using Python.

Sorry if I didn't specify what program. I was thinking of using Core Temp 1.0.
Their website is here: http://www.alcpu.com/CoreTemp/

Or using CPUz.

If I've got to choose than I'll take Core Temp 1.0

Is this enough information? If you need to know anything else just say so!
 
A

Alexander Blinne

Hello,

by having a quick look at their website i found a plugin for CoreTemp
which acts as a server and can be asked for status information of the
cpu. Now your task is really simple: write a little function or class
that opens a network socket, connects to that plugin und asks it for the
information you require. You just need to find out what network protocol
this plugin uses to communicate. If it is no standard protocol for which
a higher level module is present (xmlrpc or something), see
http://docs.python.org/3/library/socket.html for low level sockets.

Greetings
 
O

Owatch

Re

Hello,



by having a quick look at their website i found a plugin for CoreTemp

which acts as a server and can be asked for status information of the

cpu. Now your task is really simple: write a little function or class

that opens a network socket, connects to that plugin und asks it for the

information you require. You just need to find out what network protocol

this plugin uses to communicate. If it is no standard protocol for which

a higher level module is present (xmlrpc or something), see

http://docs.python.org/3/library/socket.html for low level sockets.



Greetings

Really sorry for the late reply, but I've got a lot going on lately.

Thanks a TON for your answer thought, this is exactly what I really hoped for.
The problem for me is that I don't actually know anything about writing a function that opens a network socket, and "connects to that plugin und asks it for the
information you require."

That's all really beyond me, all I can do is what I did so far, which is make it ask for your temperature value, and then test it to see if its an integer

Then (I added this for testing) It asks for any temperature value. And if it exceeds the given limit, it rings an alarm. Until it freezes and becomes unresponsive :D

I don't know how to make it 'query' or grab values constantly, if you don't mind my potentially incorrect terminology.

If you know how to do this, or could explain it really step by step to me, I would be ever so thankful. Or even if you know of somewhere which I could ask this.

Thanks!!!
 
A

Alexander Blinne

Am 05.12.2012 21:24, schrieb Owatch:
Thanks a TON for your answer thought, this is exactly what I really hoped for.
The problem for me is that I don't actually know anything about writing a function that opens a network socket, and "connects to that plugin und asks it for the
information you require."

That plugin should have some documentation which should tell you
something about how to connect to it and how to request information.
When you know that you can turn to the python documentation and find out
how to do this in python.
That's all really beyond me, all I can do is what I did so far, which is make it ask for your temperature value, and then test it to see if its an integer

Then (I added this for testing) It asks for any temperature value. And if it exceeds the given limit, it rings an alarm. Until it freezes and becomes unresponsive :D

If you have specific problems with code you have written, try to build
up a minimal "working" example that shows the problem plus any error
messages/exceptions/stack traces you get back. We might be able to help
you with your code.
I don't know how to make it 'query' or grab values constantly, if you don't mind my potentially incorrect terminology.

This is typically done with some kind of loop, e.g.

run = True
while run:
#do something repeatedly and do "run = False" if you want to stop
pass

Greetings
Alexander
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top