pathlib PurePosixPath
Peter Otten
__peter__ at web.de
Tue Oct 10 04:49:50 EDT 2017
Sayth Renshaw wrote:
> Thanks. Updated the script. But shouldn't it create the file if it doesn't
> exist? Which none of them will.
> pathlib.PurePath(r'C:\Users\Sayth\Projects\results', file_name)
> with open(result_path, 'a') as f:
> f.write(data)
> ##Output
> File "C:/Users/Sayth/PycharmProjects/ubet_api_mongo/json_download.py",
> line 42, in <module>
> with open(result_path, 'a') as f:
> FileNotFoundError: [Errno 2] No such file or directory:
> 'C:\\Users\\Sayth\\Projects\\results\\Warwick Farm_2017-09.json'
Read the error message carefully. My crystal ball says that the directory
C:\Users\Sayth\Projects\results
does not exist.
More information about the Python-list
mailing list