Python TypeError: an integer is required comparing times -


There are lots of threads with questions like me, but I can not find the right answer.

My goal is to create a statement that compares the time compared to the time (time determined by start time and end time).

If I schedule specific numbers, but I need to pass variables in my description that this schedule is not going to be static.

What I have so far:

  Shocker Diet Scheduler (as import time): Dantime Import Time-Time = () Def Scheduler (): conn = Pymysql.connect (host = 'myhost', db = 'test', user = '1234', passwd = '123456', autocommit = true) = Conn.cursor () query = ("Start selectionTitHour, starttime, endimehore, And Schedule from TMEMUNEET where HVID =% s ") print queue qu.execute (query, (number)) for the row in line: print line door_schedule_list.append (line) cur.close () conn.close () LAN (door_schedule_list) & gt; 0: start_time_hour = door_schedule_list [0] [0] end_time_hour = door_schedule_list [0] [2] end_time_minute = door_schedule_list [0] [3] print start_time_hour print start_time_minute print end_time_hour print end_time_minute while true: now Printed "Schedule" ("% d", "% D")% (start_time_hour, start_time_minute, end_time_hour, end_time_minute): print "schedule active" sleeptime.sleep (20) Other: print "schedule schedule" sleeptime.sleep (20 )  

If there is an easy way to accomplish my goal then please tell me otherwise how can I correct the error.

When you do:

  If the time ("% d" , "% D") & lt; = Now.time () & lt; = Time ("% d", "% d")% (start_time_hour, start_time_minute, end_time_hour, end_time_minute)  

this % operator does not think you are What you should do.

This is not the same:

  Time ("% d", "% d") time ("% d"% 5, "% d"% 4)  

 % (5, 4)  

The last line will have a complaint with the error: An integer is required

You can also:

  hours = 5 minutes = 4 time (hours, minutes)  

then you can change the line:

  if the time (start_time_hour, start_time_minute) & lt; = Now.time () & lt; = Time (end_time_hour, end_time_minute)  

Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -