Tue, 08 Nov 2016 19:01:35 +0100
Fixed an issue in the Project class caused by empty main script entry.
Project/Project.py | file | annotate | diff | comparison | revisions |
--- a/Project/Project.py Tue Nov 08 19:00:07 2016 +0100 +++ b/Project/Project.py Tue Nov 08 19:01:35 2016 +0100 @@ -2219,8 +2219,12 @@ .format(self.ppath)) return - try: - ms = os.path.join(self.ppath, self.pdata["MAINSCRIPT"]) + if self.pdata["MAINSCRIPT"]: + if not os.path.isabs(self.pdata["MAINSCRIPT"]): + ms = os.path.join( + self.ppath, self.pdata["MAINSCRIPT"]) + else: + ms = self.pdata["MAINSCRIPT"] if not os.path.exists(ms): try: f = open(ms, "w") @@ -2234,7 +2238,7 @@ " be created.<br/>Reason: {1}</p>") .format(self.ppath, str(err))) self.appendFile(ms) - except IndexError: + else: ms = "" # add existing files to the project @@ -2484,12 +2488,14 @@ projectType = self.pdata["PROJECTTYPE"] dlg.storeData() self.setDirty(True) - try: - ms = os.path.join(self.ppath, self.pdata["MAINSCRIPT"]) + if self.pdata["MAINSCRIPT"]: + if not os.path.isabs(self.pdata["MAINSCRIPT"]): + ms = os.path.join( + self.ppath, self.pdata["MAINSCRIPT"]) + else: + ms = self.pdata["MAINSCRIPT"] if os.path.exists(ms): self.appendFile(ms) - except IndexError: - pass if self.pdata["PROJECTTYPE"] != projectType: # reinitialize filetype associations @@ -2756,9 +2762,12 @@ if restoreSession: # open the main script if self.pdata["MAINSCRIPT"]: - self.sourceFile.emit( - os.path.join( - self.ppath, self.pdata["MAINSCRIPT"])) + if not os.path.isabs(self.pdata["MAINSCRIPT"]): + ms = os.path.join( + self.ppath, self.pdata["MAINSCRIPT"]) + else: + ms = self.pdata["MAINSCRIPT"] + self.sourceFile.emit(ms) # open a project session file being quiet about errors if reopen: