Example #1
0
    def exportSpreadsheet2(self):
        import sys
        from install.module import installmodule

        module = "xlsxwriter"

        # Check if essential module is installed
        try:
            import xlsxwriter
            moduleInstalled = True
        except:
            moduleInstalled = False

        # Install essential module if it is absent
        if not moduleInstalled:
            installmodule(module)
        if not module in sys.modules:
            try:
                import xlsxwriter
                self.runExportSpreadsheet2()
            except:
                #self.displayMessage("Package '{0}' is required but not installed!\nRun 'pip3 install {0}' to install it first.".format(module))
                self.exportSpreadsheet3()
        else:
            self.runExportSpreadsheet2()
Example #2
0
    def exportSpreadsheet(self):
        import sys
        from install.module import installmodule

        module = "openpyxl"

        # Check if essential module is installed
        try:
            from openpyxl import Workbook
            moduleInstalled = True
        except:
            moduleInstalled = False

        # Install essential module if it is absent
        if not moduleInstalled:
            installmodule(module)
        if not module in sys.modules:
            try:
                from openpyxl import Workbook
                self.runExportSpreadsheet()
            except:
                #self.displayMessage("Package '{0}' is required but not installed!\nRun 'pip3 install {0}' to install it first.".format(module))
                # openpyxl requires pyton version 3.6+, try alternative 'xlsxwriter'
                self.exportSpreadsheet2()
        else:
            self.runExportSpreadsheet()