Changeset 6446


Ignore:
Timestamp:
Dec 11, 2017, 5:09:37 PM (2 years ago)
Author:
mabarracus
Message:

Change tempnam to tempfile safe function avoiding warnings

Location:
hwdetector/trunk/fuentes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • hwdetector/trunk/fuentes/debian/changelog

    r6445 r6446  
     1hwdetector (0.1.7.2) xenial; urgency=medium
     2
     3  * Change tempnam to tempfile safe function avoiding warnings
     4
     5 -- M.Angel Juan <m.angel.juan@gmail.com>  Mon, 11 Dec 2017 17:08:36 +0100
     6
    17hwdetector (0.1.7.1) xenial; urgency=medium
    28
  • hwdetector/trunk/fuentes/hwdetector.install/hwdetector/utils/log.py

    r6445 r6446  
    22import sys
    33import logging
     4import tempfile
    45import os
     6
    57try:
    68    import colorlog
     
    1416        self.level = logging.INFO
    1517        self.disabled = False
    16         self.filename_to_log = os.tempnam('/tmp','valentin-debug-log-messages-') + '.txt'
     18        self.filename_to_log = tempfile.mkstemp()[1] + '.txt'
    1719        super(logger,self).__init__(*args,**kwargs)
     20
     21    def __exit__(self, exc_type, exc_value, traceback):
     22        if os.path.exists(self.filename_to_log):
     23            os.remove(self.filename_to_log)
    1824
    1925    def initLog(self,*args,**kwargs):
Note: See TracChangeset for help on using the changeset viewer.