python time
ecu_jon
hayesjdno3 at yahoo.com
Mon Mar 21 00:07:13 EDT 2011
so then why does this not work ?
from datetime import datetime
from os.path import join, getsize
import time,os,string,getpass,md5,ConfigParser
from time import strftime,localtime
config = ConfigParser.ConfigParser()
config.read("config.ini")
date = config.get("myvars", "date")
time = config.get("myvars", "time")
#print "date is ",date , " time is ",time
a=1
while a>0:
#import time
time.sleep(2)
if datetime.now().weekday() == int(date):
str_time=strftime("%H:%M",localtime())
print "do it"
Traceback (most recent call last):
File "I:\college\spring11\capstone-project\time-test.py", line 25,
in <module>
time.sleep(2)
AttributeError: 'str' object has no attribute 'sleep'
>>>
if i uncomment the import time line in the while loop it works.
boggle...
More information about the Python-list
mailing list