Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!cs.uu.nl!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python,': 0.02; 'subject:Python': 0.05; 'error:': 0.05; 'msg': 0.07; 'defined,': 0.09; 'msg)': 0.09; 'nameerror:': 0.09; 'received:67.192': 0.09; 'received:67.192.241': 0.09; 'received:dfw.emailsrvr.com': 0.09; '*real*': 0.16; '36,': 0.16; 'alexander': 0.16; 'doesnt': 0.16; 'isnt': 0.16; 'temp': 0.16; 'wrote:': 0.17; 'code,': 0.18; 'received:emailsrvr.com': 0.22; 'sends': 0.22; 'defined': 0.22; 'work.': 0.23; 'command': 0.24; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; '(most': 0.27; 'is?': 0.27; 'run': 0.28; 'cpu': 0.29; 'gary': 0.29; 'probably': 0.29; "we're": 0.30; "skip:' 10": 0.30; 'checks': 0.30; 'received:(smtp server)': 0.30; 'file': 0.32; 'could': 0.32; 'traceback': 0.33; 'anyone': 0.33; 'to:addr:python-list': 0.33; 'another': 0.33; 'pm,': 0.35; 'but': 0.36; 'totally': 0.36; 'does': 0.37; 'two': 0.37; 'why': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'skip:" 10': 0.40; 'your': 0.60; 'subject:, ': 0.61; 'show': 0.63; 'want,': 0.65; 'email,': 0.66; 'cpu,': 0.84; 'temperature': 0.84 X-Virus-Scanned: OK Date: Sat, 22 Dec 2012 12:45:29 -0800 From: Gary Herron User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Python, email temperature References: <543ec063-14c1-4ca6-a911-ae6f58c22a8c@googlegroups.com> In-Reply-To: <543ec063-14c1-4ca6-a911-ae6f58c22a8c@googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 35 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1356209504 news.xs4all.nl 6898 [2001:888:2000:d::a6]:49677 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:35385 On 12/22/2012 12:36 PM, Alexander Ranstam 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 > 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? > > Thanx! > > //Alexander > Could it be this easy? In one spot you refer to it as "cpu_temperature" and in another as "cputemp". If that's not it, you'd probably better show us your *real* code, otherwise we're just guessing. Gary Herron