Closed christhompson closed 6 years ago
Quick followup: This works on 3.6rc1, as they added support for Path-like objects:
Changed in version 3.6: Accepts a path-like object.
(https://docs.python.org/3/library/os.html#os.remove)
But that doesn't work in 3.5.
Similarly for Path.resolve(strict=false)
in 3.6rc1: https://docs.python.org/3/library/pathlib.html#pathlib.Path.resolve
It looks like https://github.com/18F/domain-scan/commit/ccf5e040a99ab11d86e799970eb25087ff230b70 made this change without realizing the impact to Python 3.5. Thanks for reporting it.
I'm up for fixing this, but is 3.5 support important for you? I could also see us just raising the expected Python version to 3.6, since it's become relatively easy/clean to upgrade Python versions.
Yeah, I'd say that Python 3.5 support is not that important (it's the default python3 on my workstation but I can just opt-in to Python 3.6 for now), so the easier solution is probably to just bump the minimum version requirement to Python 3.6 in the readme.
:+1: Filed https://github.com/18F/domain-scan/pull/262 to do this.
From a fresh clone, running the pshtt scanner with Python 3.5.3:
scan domains.csv --scan=pshtt --workers=36
Looking at
begin_csv_writing
: https://github.com/18F/domain-scan/blob/ad6ea2fadc79500eb2060f4f281550f32127e47a/utils/scan_utils.py#L572The
Path.resolve()
call can't succeed since it throwsFileNotFoundError
if the file doesn't exist (https://docs.python.org/3.5/library/pathlib.html#pathlib.Path.resolve), andscan
tries to delete the file if it already exists before this.Removing the call to
resolve()
allows the scan to work. (Or, ifresults/
is guaranteed to exist, then this could bePath("results/").resolve().joinpath("pshtt.csv")
.)If results/pshtt.csv already exists, however, the following error occurs:
Which implicates: https://github.com/18F/domain-scan/blob/ad6ea2fadc79500eb2060f4f281550f32127e47a/scan#L131-L134
Inspecting, it appears that
type(result)
isPosixPath
, but I thinkos.remove()
expects a string, so this should maybe beos.remove(str(result))
(https://docs.python.org/3.5/library/os.html#os.remove).