Closed Knight-X closed 7 years ago
https://docs.python.org/3/library/pathlib.html Path.resolve(strict=False) Make the path absolute, resolving any symlinks. A new path object is returned: If the path doesn’t exist and strict is True, FileNotFoundError is raised.
before call path.resolve(), the folder should be existed in linux environment. Otherwise, it would output error message.
the parameter in os module should be str
Thanks for the PR, merged.
Traceback (most recent call last): File "compileTestData.py", line 28, in
FULL_OUTPUT_DIR = (Path.cwd() / OUTPUT_DIR).resolve()
File "/usr/lib/python3.5/pathlib.py", line 1109, in resolve
s = self._flavour.resolve(self)
File "/usr/lib/python3.5/pathlib.py", line 330, in resolve
return _resolve(base, str(path)) or sep
File "/usr/lib/python3.5/pathlib.py", line 315, in _resolve
target = accessor.readlink(newpath)
File "/usr/lib/python3.5/pathlib.py", line 422, in readlink
return os.readlink(path)
FileNotFoundError: [Errno 2] No such file or directory: '/root/uTensor/TESTS/scripts/testData'
Traceback (most recent call last): File "compileTestData.py", line 47, in
exec(open(str(item), "r").read())
File "", line 17, in
File "compileTestData.py", line 26, in mkdir
os.makedirs(outPath)
File "/usr/lib/python3.5/os.py", line 226, in makedirs
head, tail = path.split(name)
File "/usr/lib/python3.5/posixpath.py", line 103, in split
i = p.rfind(sep) + 1
AttributeError: 'PosixPath' object has no attribute 'rfind'