Example #1
0
    def update(self, attribute):
        coralApp.logDebug("CustomPythonNode.update")
        inputs = self._getInputValues()
        outputs = self._getOutputValues()

        pyfilter = self._filter.value().stringValues()[0]
        if isinstance(pyfilter, list):
            pyfilter = pyfilter[0]

        try:
            exec(pyfilter)
        except:
            exc_type, exc_value, exc_traceback = sys.exc_info()
            print "*** print_tb:"
            traceback.print_tb(exc_traceback, limit=1, file=sys.stdout)
            print "*** print_exception:"
            traceback.print_exception(exc_type, exc_value, exc_traceback, limit = 2, file = sys.stdout)

        coralApp.logDebug("CustomPythonNode.update: Done")
Example #2
0
    def update(self, attribute):
        coralApp.logDebug("FindFiles.update")
        location = self._location.value().stringValueAt(0)
        pattern = self._pattern.value().stringValueAt(0)

        assets = []
        if location == "":
            return
        if not os.path.isdir(location):
            coralApp.logError("Location does not exist.")
            return
        filenames = os.listdir(location)
        for filename in filenames:
            if fnmatch.fnmatch(filename, pattern):
                fullPath = os.path.join(location, filename)
                if os.path.isfile(fullPath):
                    assets.append(fullPath)

        self._files.outValue().setPathValues(assets)
        coralApp.logDebug("FindFiles.update: Done")
Example #3
0
    def update(self, attribute):
        coralApp.logDebug("FindFiles.update")
        location = self._location.value().stringValueAt(0)
        pattern = self._pattern.value().stringValueAt(0)

        assets = []
        if location == "":
            return
        if not os.path.isdir(location):
            coralApp.logError("Location does not exist.")
            return
        filenames = os.listdir(location)
        for filename in filenames:
            if fnmatch.fnmatch(filename, pattern):
                fullPath = os.path.join(location, filename)
                if os.path.isfile(fullPath):
                    assets.append(fullPath)

        self._files.outValue().setPathValues(assets)
        coralApp.logDebug("FindFiles.update: Done")