scripts/scraper.py
def checkForOldProcesses(self):
        """
        Checks the lockfile to see if there's an older process running.
        If so, tries to kill it and deletes the lockfile.
        """
        if os.access(self.lockfile_path, os.F_OK):
            # If the file is there, check the PID number.
            lockfile = open(self.lockfile_path, "r")
            lockfile.seek(0)
            old_pid = lockfile.readline()
            if old_pid:
                try:
                    # Doesn't kill it, but checks to see if the pid exists.
                    os.kill(int(old_pid), 0)
                    try:
                        os.kill(int(old_pid), signal.SIGQUIT)
                        self.removeLockfile
                        warnings.warn(
                            "Lockfile found ("
                            + self.lockfile_path
                            + "). An instance of this program was already running "
                            + "as process "
                            + old_pid
                            + " but it was killed. Continuing"
                        )
                    except OSError:
                        # Couldn't kill it. Quit.
                        raise ScraperError(
                            (
                                "Lockfile found (%s).\nAn instance of this program is "
                                "already running as process %s but it could not be "
                                "killed.\nExiting."
                            )
                            % (self.lockfile_path, old_pid)
                        )
                except OSError:
                    # Process not running. Just delete file.
                    self.removeLockfile
            else:
                warnings.warn(
                    "Lockfile found ("
                    + self.lockfile_path
                    + ") but it did not contain a PID. Deleting it and continuing."
                )

        Checks the lockfile to see if there's an older process running.
        If so, tries to kill it and deletes the lockfile.
        
Checks the lockfile to see if there's an older process running.
If so, tries to kill it and deletes the lockfile.
Checks the lockfile to see if there ' s an older process running . If so tries to kill it and deletes the lockfile .
def checkForOldProcesses(self):
        if os.access(self.lockfile_path, os.F_OK):
            lockfile = open(self.lockfile_path, "r")
            lockfile.seek(0)
            old_pid = lockfile.readline()
            if old_pid:
                try:
                    os.kill(int(old_pid), 0)
                    try:
                        os.kill(int(old_pid), signal.SIGQUIT)
                        self.removeLockfile
                        warnings.warn(
                            "Lockfile found ("
                            + self.lockfile_path
                            + "). An instance of this program was already running "
                            + "as process "
                            + old_pid
                            + " but it was killed. Continuing"
                        )
                    except OSError:
                        raise ScraperError(
                            (
                                "Lockfile found (%s).\nAn instance of this program is "
                                "already running as process %s but it could not be "
                                "killed.\nExiting."
                            )
                            % (self.lockfile_path, old_pid)
                        )
                except OSError:
                    self.removeLockfile
            else:
                warnings.warn(
                    "Lockfile found ("
                    + self.lockfile_path
                    + ") but it did not contain a PID. Deleting it and continuing."
                )
def checkForOldProcesses ( self ) : if os . access ( self . lockfile_path , os . F_OK ) : lockfile = open ( self . lockfile_path , "r" ) lockfile . seek ( 0 ) old_pid = lockfile . readline ( ) if old_pid : try : os . kill ( int ( old_pid ) , 0 ) try : os . kill ( int ( old_pid ) , signal . SIGQUIT ) self . removeLockfile warnings . warn ( "Lockfile found (" + self . lockfile_path + "). An instance of this program was already running " + "as process " + old_pid + " but it was killed. Continuing" ) except OSError : raise ScraperError ( ( "Lockfile found (%s).\nAn instance of this program is " "already running as process %s but it could not be " "killed.\nExiting." ) % ( self . lockfile_path , old_pid ) ) except OSError : self . removeLockfile else : warnings . warn ( "Lockfile found (" + self . lockfile_path + ") but it did not contain a PID. Deleting it and continuing." )
Checks the lockfile to see if there's an older process running.
Checks the lockfile to see if there ' s an older process running .
"""
        Checks the lockfile to see if there's an older process running.
        If so, tries to kill it and deletes the lockfile.
        """ # If the file is there, check the PID number. # Doesn't kill it, but checks to see if the pid exists. # Couldn't kill it. Quit. # Process not running. Just delete file.
self