[Tutor] time.sleep does not return at turn of the hour!!!

Mohamed Lrhazi mohamed at your-site.com
Sun Nov 7 04:03:27 CET 2004


Hello all,

I am stuck with is strange problem. Here is the srouce:

...
while 1:
			self.where=self.fp.tell()
			inbuffer=self.fp.read(self.inbuffersize)
			if not inbuffer:
				if self.onefile:
					self.lines=["DONE"]
					break
				new_filename=self.makeFileName()
				if not new_filename == self.filename:
					old_filename=self.filename
					self.fileShift()
					fileshifted=1
					passe=0
					break
				passe=passe+1
				#if not passe % 60:
				log.logLine('logStream.refillLines',"%d: Waiting for new 
lines..."%(passe))
				time.sleep(1) #It seems at the turn of the hour, we dont wakeup at all 
from this call!!!
				log.logLine('logStream.refillLines',"%d: Woke up..."%(passe))
				self.fp.seek(self.where)
			else:
				self.bytesRead = self.bytesRead + len(inbuffer)
			
...

Here is the output:

1106 20:59:56:logStream.refillLines: 7: Waiting for new lines...
1106 20:59:57:logStream.refillLines: 7: Woke up...
1106 20:59:57:logStream.refillLines: 8: Waiting for new lines...
1106 20:59:58:logStream.refillLines: 8: Woke up...
1106 20:59:58:logStream.refillLines: 9: Waiting for new lines...
1106 20:59:59:logStream.refillLines: 9: Woke up...
1106 20:59:59:logStream.refillLines: 10: Waiting for new lines...


It just hangs there... till I control-C and then:

Traceback (most recent call last):
  File "./parseDaemon.py", line 355, in ?
    l=zeusLog.getNextLine()
  File "./parseDaemon.py", line 237, in getNextLine
    self.refillLines()
  File "./parseDaemon.py", line 206, in refillLines
    time.sleep(1) #It seems at the turn of the hour, we dont wakeup at all 
from this call!!!
KeyboardInterrupt


This happens systematically and only when we turn to the next Hour!!!

I tried with both python python-2.2.3-7 and python2.3-2.3.3-2pydotorg
I am using Fedora Core 1

Any ideas?

Thanks,
Mohamed~



More information about the Tutor mailing list