The correct call is 'self._writeSetupFile()' so here is a big mistake on catching any kind of exception and saying you could not publish the files, try to catch known exceptions not all, because this kind of mistakes can easily be made.