def __init__(self):
        self.re_pid = re.compile(r'ktmp([0-9a-f]{5})$', re.IGNORECASE)

        self.temp_path = os.path.join(tempfile.gettempdir(), 'ktmp%05x' % os.getpid())

        if not os.path.exists(self.temp_path):
            try:
                os.mkdir(self.temp_path)
            except (IOError, OSError) as e:
                self.temp_path = tempfile.gettempdir()