The below code gives me the error, other than changing the module that plays the (winsound) sound, this worked fine on Python2.6 on Windows. Not sure where I have gone wrong on this one. This is being run on a Linux box, previously on a Windows machine. The version on Windows was 2.6 and version on Linux is 2.7.3.
Traceback (most recent call last): File "CallsWaiting.py", line 9, in first_time = time.time() AttributeError: 'int' object has no attribute 'time'
import _mysql
import sys
import time
import os
import pygame
pygame.init()
time = 3
first_time = time.time()
last_time = first_time
while True:
pass
new_time = time.time()
if new_time - last_time > timeout:
last_time = new_time
os.system('cls')
iswaiting = 0
print "Calls Waiting: "
con = _mysql.connect(host='oip-prod', port=3308, user='admin', passwd='1234', db='axpdb')
con.query("select callswaiting from callcenterinformation where date - date(now()) and skillid = 2 order by time desc limit 1;")
result = con.user_result()
iswaiting = int('',join(result.fetch_row() [0]))
print "%s" % \
iswaiting
if iswaiting > 0:
print "Calls are waiting!"
pygame.mixer.init()
sounda = pygame.mixer,Sound("ring2.wav")
sounda.play()