Python Noob Question.

Discussion in 'Python' started by Owatch, Dec 2, 2012.

  1. Owatch

    Owatch Guest

    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.
     
    Owatch, Dec 2, 2012
    #1
    1. Advertising

  2. 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
     
    Steven D'Aprano, Dec 2, 2012
    #2
    1. Advertising

  3. On Sun, 2 Dec 2012 12:33:58 -0800 (PST), Owatch
    <> 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/forums/en-US/netfxbcl/thread/34f0fa55-567b-4a98-a29d-b92a5c9b5f8f/

    http://stackoverflow.com/questions/3262603/accessing-cpu-temperature-in-python
    --
    Wulfraed Dennis Lee Bieber AF6VN
    HTTP://wlfraed.home.netcom.com/
     
    Dennis Lee Bieber, Dec 3, 2012
    #3
  4. Owatch

    Owatch Guest

    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!
     
    Owatch, Dec 3, 2012
    #4
  5. 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
     
    Alexander Blinne, Dec 3, 2012
    #5
  6. Owatch

    Owatch Guest

    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 :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!!!
     
    Owatch, Dec 5, 2012
    #6
  7. 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
     
    Alexander Blinne, Dec 10, 2012
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ArtDent
    Replies:
    3
    Views:
    490
    Josiah Carlson
    Feb 7, 2004
  2. Lilavivat
    Replies:
    2
    Views:
    387
    Bjoern Schliessmann
    Dec 4, 2006
  3. CarlP
    Replies:
    3
    Views:
    324
    Bruno Desthuilliers
    Jun 30, 2007
  4. johnny
    Replies:
    2
    Views:
    283
    Robert Kern
    Sep 10, 2007
  5. रवींदर ठाकà¥à¤° (ravinder thakur

    noob question : library versus normal python files

    रवींदर ठाकà¥à¤° (ravinder thakur, Jun 6, 2008, in forum: Python
    Replies:
    1
    Views:
    291
Loading...

Share This Page