<p>我创建了一个小函数,将所有错误记录到一个新文件中,但是在我不应该出现错误的时候我却出现了错误。我到处搜索,这个问题的所有答案都使用了我现在使用的相同方法,但是我出现了错误。你知道吗</p>
<pre><code>with open(f'Z:/FTP/errors/error-{get_timestamp(False)}.txt', 'w+') as f:
f.write(str(e))
</code></pre>
<p>上面是我的代码,下面是我收到的错误(已截断):</p>
<pre><code> File "Main.py", line 42, in log_error
with open(f'Z:/FTP/errors/error-{get_timestamp(False)}.txt', 'w+') as f:
FileNotFoundError: [Errno 2] No such file or directory: 'Z:/FTP/errors/error-2017-10-14T19:08:07.577362.txt'
</code></pre>
<p>出什么问题了?我是不是太瞎了,看不见自己犯的错误?你知道吗</p>