[python-win32] syntax?

Gowtham narisipalli at gmail.com
Sun Jan 17 15:32:26 CET 2010


Hi Alex,

I understand your code but its very difficult to read in python if the
indentation is not clear. Run through the Python style guide -
http://www.python.org/dev/peps/pep-0008/ or Google's pyguide -
http://google-styleguide.googlecode.com/svn/trunk/pyguide.html

Typical indentation is 4 spaces.

Cheers.

On Fri, Jan 15, 2010 at 7: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
> _______________________________________________
> python-win32 mailing list
> python-win32 at python.org
> http://mail.python.org/mailman/listinfo/python-win32
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20100117/8f4642d5/attachment.htm>


More information about the python-win32 mailing list