<s> from win32event import CreateMutex <EOL> from win32api import CloseHandle , GetLastError <EOL> from winerror import ERROR_ALREADY_EXISTS <EOL> class singleinstance : <EOL> def __init__ ( self ) : <EOL> self . mutexname = "<STR_LIT>" <EOL> self . mutex = CreateMutex ( None , False , self . mutexname ) <EOL> self . lasterror = GetLastError ( ) <EOL> def aleradyrunning ( self ) : <EOL> return ( self . lasterror == ERROR_ALREADY_EXISTS ) <EOL> def __del__ ( self ) : <EOL> if self . mutex : <EOL> CloseHandle ( self . mutex ) </s>
