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