Skip to content

Commit

Permalink
BatchRvt: improve error handling for the case where an Excel Revit Fi…
Browse files Browse the repository at this point in the history
…le list is specified but an Excel installation is not detected.
  • Loading branch information
DanRumery committed May 1, 2018
1 parent 4b06e04 commit 45480dc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
3 changes: 3 additions & 0 deletions BatchRvt/Scripts/batch_rvt_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ def ReadRevitFileList(self, output):
if not File.Exists(self.RevitFileListFilePath):
output()
output("ERROR: No Revit file list specified or file not found.")
elif revit_file_list.HasExcelFileExtension(self.RevitFileListFilePath) and not revit_file_list.IsExcelInstalled():
output()
output("ERROR: Could not read from the Excel Revit File list. An Excel installation was not detected!")
else:
revitFileList = revit_file_list.GetRevitFileList(self.RevitFileListFilePath)
if revitFileList is None:
Expand Down
9 changes: 2 additions & 7 deletions BatchRvt/Scripts/revit_file_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,8 @@ def HasExcelFileExtension(filePath):
return any(path_util.HasFileExtension(filePath, extension) for extension in [".xlsx", ".xls"])

def FromExcelFile(excelFilePath):
centralFilePaths = []
if IsExcelInstalled():
import excel_util
centralFilePaths = GetCentralFileListFromRows(excel_util.ReadRowsTextFromWorkbook(excelFilePath))
else:
raise Exception("ERROR: An Excel installation was not detected! Support for Excel files requires an Excel installation.")
return centralFilePaths
import excel_util
return GetCentralFileListFromRows(excel_util.ReadRowsTextFromWorkbook(excelFilePath))

def FromConsole():
return FromLines(console_util.ReadLines())
Expand Down

0 comments on commit 45480dc

Please sign in to comment.