def createSetup(self):
    try:
        setupFile = (self.foldName.replace('\\', '/') + '/setup.py')
        with open(setupFile, 'w') as fd:
            if (not self.checkBox.isChecked()):
                fd.write('from distutils.core import setup\n')
                fd.write('import py2exe\n')
                fd.write(("setup(console =['%s'])" % os.path.basename(self.filePath)))
            else:
                fd.write('from distutils.core import setup\n')
                fd.write('import py2exe\n')
                fd.write(("setup(windows =['%s'])" % os.path.basename(self.filePath)))
        self.cmdProcess()
        shutil.rmtree(('%s/build' % self.foldName.replace('\\', '/')))
        os.rename('dist', os.path.basename(self.filePath).split('.')[0])
        self.displayError(parent=self, m='Process done successfully!!!', t='Process Done')
    except Exception as e:
        self.displayError(parent=self, m='Please Enter all the values\nbefore clicking process button', t='Invalid Values', type=QtGui.QMessageBox.Critical)
def createSetup(self):
    try:
        setupFile = (self.foldName.replace('\\', '/') + '/setup.py')
        with open(setupFile, 'w') as fd:
            if (not self.checkBox.isChecked()):
                fd.write('from distutils.core import setup\n')
                fd.write('import py2exe\n')
                fd.write(("setup(console =['%s'])" % os.path.basename(self.filePath)))
            else:
                fd.write('from distutils.core import setup\n')
                fd.write('import py2exe\n')
                fd.write(("setup(windows =['%s'])" % os.path.basename(self.filePath)))
        self.cmdProcess()
        shutil.rmtree(('%s/build' % self.foldName.replace('\\', '/')))
        os.rename('dist', os.path.basename(self.filePath).split('.')[0])
        self.displayError(parent=self, m='Process done successfully!!!', t='Process Done')
    except Exception as e:
        self.displayError(parent=self, m='Please Enter all the values\nbefore clicking process button', t='Invalid Values', type=QtGui.QMessageBox.Critical)