Re: Python Guru needed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jim wrote:
FC 10/KDE

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


Thanks  Jim


In Python indentation matters. And it needs to be consistent within a block. The python interpreter is telling you that you should have started an indented block at the while but there is no indented block. Do a search for a python tutorial on the web or go to http://www.python.org and I think there is a link to a tutorial.

Do you have the original of the script?  It should have the correct indentation.  I've also indented it correctly above.

--
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux