# Copyright 2008-2010 eGovMon # This program is distributed under the terms of the GNU General # Public License. # # This file is part of the eGovernment Monitoring # (eGovMon) # # eGovMon is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # eGovMon is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with eGovMon; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, # MA 02110-1301 USA """This is to avoid the unknown error 514 http://www.tummy.com/journals/entries/jafo_20070110_154659 Usage: At the begging of a module write the following: from egovmontime import * This will avoid Unknown error 514 for all time time.sleep(...) is called. Even if time is imported after this line. Note that the following will restart Example: >>> from egovmontime import * >>> time.sleep(0.1) #Safe sleeping >>> import time >>> time.sleep(0.1) #Still safe sleeping >>> time = reload(time) >>> time.sleep(0.1) #Unsafe sleeping """ __author__ = "$Author: goodwin $" __version__ = "$Revision: 803 $" __updated__ = "$LastChangedDate$" import time __import__("warnings").warn("Use of egovmontime is deprecated.", DeprecationWarning, stacklevel=2) def sleep(number): try: time.unsafesleep(number) except IOError, e: if e.errno != 514: raise e else: print 'Unknown error 514 avoided' time.unsafesleep = time.sleep time.sleep = sleep