Jeremy Pinto <jerp...@gmail.com> added the comment:

In fact, the issue seems to be coming from open() itself when opening a 
non-existent directory in write mode:

[nav] In [1]: import os
         ...: nonexixstent_dir = 'not_a_dir/'
         ...: assert not os.path.exists(nonexixstent_dir)
         ...: with open(nonexixstent_dir, 'wb') as fdst:
         ...:     pass
---------------------------------------------------------------------------
IsADirectoryError                         Traceback (most recent call last)
<ipython-input-1-73d4010d6f34> in <module>
      2 dir_path = 'not_a_dir/'
      3 assert not os.path.exists(nonexixstent_dir)
----> 4 with open(nonexixstent_dir, 'wb') as fdst:
      5     pass

IsADirectoryError: [Errno 21] Is a directory: 'not_a_dir/'

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue43219>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to