Here are the examples of the python api sys.stdout.close taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
18 Examples
3
Example 1
View licensedef __exit__(self, exc_type, exc_value, traceback): self.stdout = self.stdout.getvalue() self.stderr = self.stderr.getvalue() sys.stdout.close() sys.stderr.close() sys.stdout = self.stdout_backup sys.stderr = self.stderr_backup
3
Example 2
View licensedef tearDown( self ): #close any open sockets for s in self.sockets: s.close() #stop any running monitors - this might be open if an exception was thrown before a test called monitor.stop() if self.monitor != None: self.monitor.stop( wait_on_join=False ) self.logger.removeHandler( self.handler ) self.handler.close() #restore stdout sys.stdout.close() sys.stdout = self.old
3
Example 3
View licensedef tearDown(self): sys.stdout.close() try: os.unlink(sys.stdout.name) except: pass
3
Example 4
View licensedef finish(): try: sys.stdout.close() except: pass try: sys.stderr.close() except: pass
3
Example 5
View licensedef main(args=None, namespace=None): try: _main(args=args, namespace=namespace) finally: # This block is crucial to avoid having issues with # Python spitting non-sense thread exceptions. We have already # handled what we could, so close stderr and stdout. if not os.environ.get('CEPH_DEPLOY_TEST'): try: sys.stdout.close() except: pass try: sys.stderr.close() except: pass
3
Example 6
View licensedef close_stdio(): """Close stdout and stderr.""" try: sys.stdout.close() except IOError: pass try: sys.stderr.close() except IOError: pass
3
Example 7
View licensedef close_stdio(): """Close stdout and stderr.""" try: sys.stdout.close() except IOError: pass try: sys.stderr.close() except IOError: pass
3
Example 8
View licensedef tearDown(self): sys.stdout.close() sys.stdout = self.sysout sys.stderr.close() sys.stderr = self.syserr
3
Example 9
View licensedef _run_in_subprocess_redirect_stdout(fd): import os # @Reimport import sys # @Reimport sys.stdout.close() os.dup2(fd, 1) os.close(fd) sys.stdout = os.fdopen(1, 'w', 1)
3
Example 10
View licensedef _run_in_subprocess_redirect_stdout(fd): import os # @Reimport import sys # @Reimport sys.stdout.close() os.dup2(fd, 1) os.close(fd) sys.stdout = os.fdopen(1, 'w', 1)
3
Example 11
View licensedef redirectOutput(self): """ Redirect stdout and stderr to the bit-bucket. Windows NT Services do not do well with data being written to stdout/stderror. """ sys.stdout.close() sys.stderr.close() sys.stdout = NullOutput() sys.stderr = NullOutput()
0
0
Example 13
View licensedef __exit__(self, exc_type, exc_value, traceback): sys.stdout.close() sys.stdout = self.real_stdout
0
Example 14
View licensedef tearDown(self): sys.stdout.close() sys.stderr.close() sys.stdout = self.old sys.stdout = self.olderr if self.debug: print("############### STDOUT #################") fp = codecs.open(self.get_filename(),"r","utf-8") print(fp.read()) fp.close() print("################ STDERR #################") fp = codecs.open("err_"+self.get_filename(),"r","utf-8") print(fp.read()) fp.close() print("################ END QUIET TEST ##########") os.unlink(self.get_filename()) os.unlink("err_"+self.get_filename())
0
Example 15
View licensedef eventClose(self): print dateStamp() , ' eventCloseMethod' self.initStat = False self.disconnect(self, SIGNAL('refresh'), self.refreshData) self.disconnect(self, SIGNAL('access'), self.processInit) self.disconnect(self, SIGNAL('destroyed()'), self.eventClose) self.disconnect(self, SIGNAL('killThread'), self.killMailCheckerThread) self.idleThreadMessage.disconnect(self.idleMessage) self.idleingStopped.disconnect(self.idleingStoppedEvent) self.disableIconClick() self.deleteAkonadiMonitor() x = '' try : self.Timer.stop() if not(self.wallet is None) : self.wallet.closeWallet(self.appletName, True) print dateStamp() , ' wallet closed' except Exception, x : print dateStamp() , x, ' eventClose_1' finally : pass try : self.someFunctions.savePOP3Cache() except IOError, x : print dateStamp() ,x, ' eventClose_2' finally : pass self.killMailCheckerThread() self.GeneralLOCK.unlock() count = self.initValue('stayDebLog', '5') cleanDebugOutputLogFiles(int(count)) print dateStamp() , "MailChecker destroyed manually." #sys.stderr.close() sys.stdout.close()
0
Example 16
View licensedef __exit__(self, *args): "Return stdout" sys.stdout.close() sys.stdout = self.original_stdout
0
0
Example 18
View licensedef tearDown(self): sys.stdout.close() sys.stdout = self.stdout sys.modules.pop("game", "")