Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Python Noob Question.

Reply
Thread Tools

Python Noob Question.

 
 
Owatch
Guest
Posts: n/a
 
      12-02-2012
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.
 
Reply With Quote
 
 
 
 
Steven D'Aprano
Guest
Posts: n/a
 
      12-02-2012
On Sun, 02 Dec 2012 12:33:58 -0800, Owatch wrote:

> 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.


--
Steven
 
Reply With Quote
 
 
 
 
Dennis Lee Bieber
Guest
Posts: n/a
 
      12-03-2012
On Sun, 2 Dec 2012 12:33:58 -0800 (PST), Owatch
<(E-Mail Removed)> declaimed the following in
gmane.comp.python.general:

> 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/for...-b92a5c9b5f8f/

http://stackoverflow.com/questions/3...ture-in-python
--
Wulfraed Dennis Lee Bieber AF6VN
http://www.velocityreviews.com/forums/(E-Mail Removed) HTTP://wlfraed.home.netcom.com/

 
Reply With Quote
 
Owatch
Guest
Posts: n/a
 
      12-03-2012
On Sunday, December 2, 2012 11:44:05 PM UTC+2, Steven D'Aprano wrote:
> On Sun, 02 Dec 2012 12:33:58 -0800, Owatch wrote:
>
>
>
> > 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.
>
>
>
>
>
> --
>
> Steven


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!
 
Reply With Quote
 
Alexander Blinne
Guest
Posts: n/a
 
      12-03-2012
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
 
Reply With Quote
 
Owatch
Guest
Posts: n/a
 
      12-05-2012
Re

On Monday, December 3, 2012 4:19:51 PM UTC+2, Alexander Blinne wrote:
> 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

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!!!
 
Reply With Quote
 
Alexander Blinne
Guest
Posts: n/a
 
      12-10-2012
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


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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Here a noob, there a noob.... JimDoire MCSE 0 04-10-2008 07:23 PM
noob: reloading modified python file within Python Shell johnny Python 2 09-10-2007 08:11 PM
executing python programs as if they were on OS path (noob) Darren Dale Python 8 08-03-2004 09:46 PM
Total noob question re: python icon ArtDent Python 3 02-07-2004 04:46 AM
Python & XML & DTD (warning: noob attack!) Igor Fedorow Python 4 01-30-2004 02:53 PM



Advertisments