Python, email temperature

Joel Goldstick joel.goldstick at gmail.com
Sat Dec 22 21:44:39 CET 2012


On Sat, Dec 22, 2012 at 3:36 PM, Alexander Ranstam <ranstam at gmail.com>wrote:

> Hi!
>
> Im totally new to Python, and im using it on my Raspberry pi. I found a
> program that sends an email, and one that checks the temperature of my CPU,
> but i cant seem to combine the to into the funktion that i want, sending me
> the CPU temp via Email.
>
> The two programs work very well on their own, but this doesnt work.
>
> this works: server.sendmail(fromaddr, toaddrs, msg)
> but this doesnt: server.sendmail(fromaddr, toaddrs, cpu_temperature)
>
> despite the command "print cputemp" working in the same program.
>
> When i run the program i get the error:
>
> Traceback (most recent call last):
>   File "sendcpu.py", line 36, in <module>
>     msg = cpu_temperature
> NameError: name 'cpu_temperature' is not defined
>
> Does anyone know why the program claims that cpu_temperature isnt defined,
> when it is?
>

You should copy and paste the code here including the context around the
error.  You say print cputemp works, but cpu_temperature is not defined.
They are spelled differently.  Start there

>
> Thanx!
>
> //Alexander
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>



-- 
Joel Goldstick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20121222/7f142542/attachment.html>


More information about the Python-list mailing list