[python-win32] syntax?

Kevin Horn kevin.horn at gmail.com
Mon Jan 18 17:21:16 CET 2010


On Fri, Jan 15, 2010 at 6:26 PM, Alex Hall <mehgcap at gmail.com> wrote:

> Hi all
> I am getting a "syntax error" on the line
> def sayUsedRam():
> and I am not sure why. Nothing is wrong with that line, but I was playing
> with the preceeding function when this started happening. Does anyone see
> anything obvious about these two functions that would cause an error? I do
> not always trust errors with line numbers to give me the right line number.
> Thanks in advance for any help.
>
> def sayLoad():
> i=0
> #get proc load, currently only first core for some reason
> load=[]
> for p in c.Win32_PerfFormattedData_PerfOS_Processor():
>  load.push(p.PercentProcessorTime)
>  #speaker.say(str(load))
>  i=i+1
> #end for
> speaker.say(str(load[0])+", "+str(load[1])
> #end def
>
> def sayUsedRam():
> #get total ram and ram available
> #then speak used ram as a percent, rounded to 1 place
> for info in c.Win32_OperatingSystem():
>  ram=info.TotalVisibleMemorySize
>  freeRam=info.FreePhysicalMemory
> #end for
> #speaker.say(toBiggestBytes(freeRam,2)+". ")
> used=100-(float(freeRam)/float(ram)*100)
> speaker.say(str(round(used,1))+"% ram used.")
> #end def
>
>
> Have a great day,
> Alex
> Email: mehgcap at gmail.com
>

You appear to be missing a close paren on this line:

speaker.say(str(load[0])+", "+str(load[1])

in the sayLoad() function

Kevin Horn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20100118/163933d4/attachment.htm>


More information about the python-win32 mailing list