<br><br><div class="gmail_quote">On Wed, Jan 7, 2009 at 10:52 PM, Jim <span dir="ltr"><<a href="mailto:mickeyboa@sbcglobal.net">mickeyboa@sbcglobal.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="Wj3C7c">Ed Greshko wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Jim wrote:<br>
  <br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Arthur Pemberton wrote:<br>
    <br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Wed, Jan 7, 2009 at 5:18 PM, Arthur Pemberton <<a href="mailto:pemboa@gmail.com" target="_blank">pemboa@gmail.com</a>><br>
wrote:<br>
       <br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Wed, Jan 7, 2009 at 5:06 PM, Jim <<a href="mailto:mickeyboa@sbcglobal.net" target="_blank">mickeyboa@sbcglobal.net</a>> wrote:<br>
           <br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Matthew Flaschen wrote:<br>
               <br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Jim wrote:<br>
<br>
                   <br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
FC 10/KDE<br>
<br>
I'm trying to set a simple Alarm Clock in FC10 and I have a Python<br>
script I picked up, but I have error, running the script.<br>
Can you explain to me with # comments on each line how to make<br>
this work.<br>
<br>
import time<br>
import os<br>
<br>
not_executed = 1<br>
<br>
while(not_executed):<br>
dt = list(time.localtime(time.time())<br>
hour = dt[3]<br>
minute = dt[4]<br>
if hour == 5 and minute == 45:<br>
os.popen2("open /Users/jun/shout.mp3")<br>
not_executed = 0<br>
<br>
<br>
Error Message;<br>
<br>
$ python AlarmClock<br>
 File "AlarmClock", line 7<br>
  dt = list(time.localtime(time.time())<br>
   ^<br>
IndentationError: expected an indented block<br>
<br>
                        <br>
</blockquote>
It's because of Python's always charming significant whitespace. I.E.<br>
Python uses indenting instead of braces, making problems like this<br>
extremely common.  (No sane language even has "IndentationErrors".<br>
Also,<br>
you were missing a paren, but that's not what caused the error above.<br>
<br>
A correct version is attached.  Hopefully it will not get mangled by<br>
your client.<br>
<br>
Matt Flaschen<br>
<br>
                    <br>
</blockquote>
I ran yo<br>
$ python times.py<br>
Welcome to the talking alarm clock<br>
This program is public domain<br>
<br>
Traceback (most recent call last):<br>
 File "times.py", line 1, in <module><br>
  import time<br>
 File "/home/mickey/time.py", line 8, in <module><br>
  t = time.localtime(time.time())<br>
<br>
AttributeError: 'module' object has no attribute 'localtime'<br>
<br>
Python is having problems of execute this line.<br>
<br>
t = time.localtime(time.time())<br>
                <br>
</blockquote>
1) This is getting offtopic<br>
2) You need to at least send us the script you're using<br>
3) There is no way that that line of code doesn't work if you did<br>
`import time` first<br>
4) You may want to check and IRC channel such as<br>
irc://<a href="http://freenode.net/fedora" target="_blank">freenode.net/fedora</a><br>
            <br>
</blockquote>
Also, there are several alarm apps already in Fedora, it doesn't seem<br>
like you're trying to learn Python, so might be best to just use an<br>
already existing app.<br>
<br>
<br>
        <br>
</blockquote>
I told you in the beginning I know nothing about Python.<br>
I'm getting answers that assume, I know what your talking about, I<br>
don't, I just have a script that I'm asking how it works.<br>
What are the other scripts that are already in Fedora.<br>
<br>
    <br>
</blockquote>
I know nothing about python either.....  But the comments of others has<br>
got me to ....<br>
<br>
import time<br>
import os<br>
<br>
not_executed = 1<br>
<br>
while(not_executed):<br>
        dt = list(time.localtime(time.time()))<br>
        hour = dt[3]<br>
minute = dt[4]<br>
if hour == 5 and minute == 45:<br>
        os.popen2("open /Users/jun/shout.mp3")<br>
not_executed = 0<br>
<br>
<br>
I added a "tab" to Lines 7 and 8 as well as a closing ) on Line 7.  Note<br>
that blank lines are counted.<br>
Line 11 also has a tab added.  Hope that helps...and I hope my<br>
formatting survives.<br>
<br>
<br>
</blockquote></div></div></blockquote><div><br><br> #!/usr/bin/env python<br><br>import time<br>import os<br><br>not_executed = 1<br><br>while (not_executed):<br>   dt = list(time.localtime(time.time()))<br>   hour = dt[3]<br>
   minute = dt[4]<br>   if hour == 22 and minute == 58:<br>        os.spawnv (os.P_WAIT, "/usr/bin/mpg123", ["mpg123", "/home/mp3/Abba/Gold/queen.mp3"] )<br>        not_executed = 0</div></div>
<br clear="all"><br>-- <br>Paulo Roma Cavalcanti<br>LCG - UFRJ<br>