sophos / PS.Machine_Health

This will create a health report for every machines in an MSP/EDB/Single Sophos Central console
GNU General Public License v3.0
9 stars 4 forks source link

Suggestion: check file path prior to processing #1

Open cherdt opened 2 years ago

cherdt commented 2 years ago

Suggestion: check the file path and produce an error before running a series of lengthy API calls.

Steps to reproduce:

An error similar to the following is produced, but only after gathering all the data:

Traceback (most recent call last):
  File "Sophos_Central_Health.py", line 672, in <module>
    print_report()
  File "Sophos_Central_Health.py", line 630, in print_report
    with open(full_report_path, 'w') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/bad/path/sophos_report_21012022_16-29-09.csv'
sophosukps commented 2 years ago

That is a good call. I will do that when I get a chance. I have always trusted the user to copy and paste correctly :), but you are right it should check.

BNWEIN commented 2 months ago

Rather than just check, why not make it create the folder if it does not exist?

psmichaelcurtis commented 2 months ago

I know it is 2 years and half years since this request and I will get to it, but haven't had the time yet.