Python Noob Question.

Alexander Blinne news at blinne.net
Mon Dec 10 06:47:30 EST 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 :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




More information about the Python-list mailing list