I am using the following code to write list items to a .txt. I get a FileNotFoundError error at a specific file and cannot figure what causes the issue.
if os.path.isdir(f'C:/Users/Info/Desktop/Dissertation/Impression Management/Analyse/10 CEO Transcripts/Interviews WORK/{deal_no}/Earnings Calls Texts/{year}') == True:
with open(f'C:/Users/Info/Desktop/Dissertation/Impression Management/Analyse/10 CEO Transcripts/Interviews WORK/{deal_no}/Earnings Calls Texts/{year}/{fulldate}_{file}.txt', 'w') as filehandle:
for item in textlist_new:
filehandle.write(f'{item}\n')
Error message:
FileNotFoundError: [Errno 2] No such file or directory: 'C:/Users/Info/Desktop/Dissertation/Impression Management/Analyse/10 CEO Transcripts/Interviews WORK/3032771020/Earnings Calls Texts/2017/February 22, 2017_Event Brief of Q4 2016 Arris International PLC Earnings Call Q4 2016 and Acquisition Update - Final.pdf.txt'
However, the directory does exist and previous txt files were created without problems.