0

I am using mac osx 10.9 and python 2.7.

Made app using py2app which is basically continuously checking for save time of a file. Monitoring any changes made in the file in a while loop with small sleep in each iteration.

Process should not stop at all, but it is exiting with error-32 Broken pipe after 15-20 minutes. How to resolve it.

try:    
    while True:
        app_log.debug("while true")
        time.sleep(5)
        configProp.read(propfile)
        fileNameList=configProp.sections()
        if len(fileNameList)!=0:
            app_log.debug("fileNameList is not zero")
            for i in range(0,len(fileNameList)):
                tempnameinfile=configProp.options(fileNameList[i])
                openTimeLive = configProp.get(fileNameList[i], "openTimeLive")
                openTimeLive = float(openTimeLive)
                openTime=float(openTime)
                configureTime = 3600*float(configureTime)
                monitorTime=float(openTimeLive + configureTime)
                if monitorTime > time.time():
                    lastSavedTime = os.path.getmtime(str(tempname))
                    app_log.debug(lastSavedTime)
                    aa = abs((float(openTime)) - (float(lastSavedTime))) 
                    if abs(aa) > 1 :
                        app_log.debug("file modified")
                        t = ThreadClass(fileNameList[i])
            #             t.setDaemon(True)
                        t.start()
                        time.sleep(5)
                        configProp.set(fileNameList[i], str(tempnameinfile[0]),lastSavedTime)
                        with open(propfile, 'wb') as propFile:
                            configProp.write(propFile)
                        app_log.debug("completed")    
except Exception as e:    
        app_log.error(e) 
        print e 
imp
  • 1,967
  • 2
  • 28
  • 40

0 Answers0