pKa/Design_pKa_help.py
def lock(self):
        """
        # Obtain lock on the datafile
        # We wait max. 50 seconds before lock is released!
        """
        return
        import os, time
        locked=None
        count=0
        while not locked or count>50:
            if not os.path.isfile(self.lockfile):
                fd=open(self.lockfile,'w')
                fd.write('locked\n')
                fd.close()
                locked=1
                return
            time.sleep(1)
            print 'Waiting for lock on %s. Count: %d' %(self.lockfile,count)
            count=count+1
            if count>50:
                #self.unlock()
                raise Exception('Could not lock file')
        if not locked:
            print 'I could not obtain lock on: %s' %self.lockfile
            raise Exception()
        return

        # Obtain lock on the datafile
        # We wait max. 50 seconds before lock is released!
        
Obtain lock on the datafile
We wait max. 50 seconds before lock is released!
Obtain lock on the datafile We wait max . 50 seconds before lock is released!
def lock(self):
        return
        import os, time
        locked=None
        count=0
        while not locked or count>50:
            if not os.path.isfile(self.lockfile):
                fd=open(self.lockfile,'w')
                fd.write('locked\n')
                fd.close()
                locked=1
                return
            time.sleep(1)
            print 'Waiting for lock on %s. Count: %d' %(self.lockfile,count)
            count=count+1
            if count>50:
                raise Exception('Could not lock file')
        if not locked:
            print 'I could not obtain lock on: %s' %self.lockfile
            raise Exception()
        return
def lock ( self ) : return import os , time locked = None count = 0 while not locked or count > 50 : if not os . path . isfile ( self . lockfile ) : fd = open ( self . lockfile , 'w' ) fd . write ( 'locked\n' ) fd . close ( ) locked = 1 return time . sleep ( 1 ) print 'Waiting for lock on %s. Count: %d' % ( self . lockfile , count ) count = count + 1 if count > 50 : raise Exception ( 'Could not lock file' ) if not locked : print 'I could not obtain lock on: %s' % self . lockfile raise Exception ( ) return
Obtain lock on the datafile
 We wait max.
Obtain lock on the datafile We wait max .
"""
        # Obtain lock on the datafile
        # We wait max. 50 seconds before lock is released!
        """ #self.unlock()
self