In LungCTAnalyzer 2.49 in Slicer 5.0.2 in macOS 12.4 with Python 3.9.10, when generating PDF report: report is generated in LungCTAnalyzerReports but Python Interactor shows
modules/LungCTAnalyzer.py", line 843, in onCreatePDFReportButton
os.startfile(reportPath.replace('/', '\\'))
AttributeError: module 'os' has no attribute 'startfile'
Seems os.startfile is Windows-specific, and macOS may need os.system("open myFile").
The error is not seen with Create CSV file (after PDF report generation).
@rbumm Thank you for the quick-fix. The error does not appear, but on macOS, the generated PDF report is not opened automatically, which I believe is the intent. In error messages I see: The file /\Users\ashipde\Documents\LungCTAnalyzerReports\[redacted].pdf does not exist. But the file exists… seems backslashes are the issue (macOS/Unix using forward ones unlike Windows).
The file-missing error is gone after the latest fix. Interactor window shows Starting '/Users/ashipde/Documents/LungCTAnalyzerReports/[redacted].pdf' .... However, the PDF file does not auto-open. My system Python opens the file in PDF viewer app with subprocess.call(['open', '/Users/ashipde/Documents/LungCTAnalyzerReports/[redacted].pdf']), so not sure what may be the issue.
@ashipde please try if the same subprocess call opens the file in Slicer’s Python interactor. If it does not work then you may need to use the startup environment.
My mistake. The report file does auto-open as expected with the latest GitHub download of the extension. May be my extension uninstall/re-install was not done properly by me.