Hive-Systems / pyfair

Factor Analysis of Information Risk (FAIR) model written in Python. Managed and maintained by Hive Systems
https://www.hivesystems.com
MIT License
89 stars 45 forks source link

pyfair problems on Windows 10 - FairSimpleReport gives [WinError 123] '<stdin>' #15

Closed dougmcdorman closed 4 years ago

dougmcdorman commented 4 years ago

When I try to run the sample from readme.md it works once I add the dependencies (scipy, pandas, matplotlib) until it tries to create a report. I have been able to successfully do the exact same thing on Ubuntu. On Windows 10 I get the following error (Python3.8):

fsr = pyfair.FairSimpleReport([model1, mm])

Traceback (most recent call last):

File "", line 1, in File "C:\Python38\lib\site-packages\pyfair\report\simple_report.py", line 24, in init super().init() File "C:\Python38\lib\site-packages\pyfair\report\base_report.py", line 60, in init self._caller_source = self._set_caller_source() File "C:\Python38\lib\site-packages\pyfair\report\base_report.py", line 69, in _set_caller_source elif name.exists(): File "C:\Python38\lib\pathlib.py", line 1388, in exists self.stat() File "C:\Python38\lib\pathlib.py", line 1194, in stat return self._accessor.stat(self) OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: ''

theonaunheim commented 4 years ago

Thanks for the bug report. Sorry about the delayed response--I missed the email notification.

Background: the FairSimpleReport is supposed to include the text of the script that ran it. It was written in contemplation of people running their model within a discrete script so that source code of the simulation is saved. I neglected to account for people running the code in the interactive interpreter (I think this is how it came up because it was how I replicated it).

I am going to tweak the class so that any "source" that isn't a an existing .py file on the system (e.g. stdin, Jupyter, etc.) gives a generic "This was not executed from a .py file." message in the report. Should be able to knock that out in the next day or so, I think.

theonaunheim commented 4 years ago

@dougmcdorman I believe I have corrected this issue. Would you please update via pip and see if it works on your machine? If so, please close this issue at your convenience. Thanks again.

dougmcdorman commented 4 years ago

Excellent, that did it.