windows kicks up a ENOENT when a part of the path is not a dir

This commit is contained in:
Benjamin Peterson 2011-08-18 14:39:57 -05:00
parent 7636dc76e0
commit 5bd34f8ecc
1 changed files with 3 additions and 1 deletions

View File

@ -158,7 +158,9 @@ def _write_pyc(co, source_path, pyc):
try:
fp = open(pyc, "wb")
except IOError:
if sys.exc_info()[1].errno == errno.ENOTDIR:
err = sys.exc_info()[1].errno
if (err == errno.ENOTDIR or
sys.platform == "win32" and err == errno.ENOENT):
# This happens when we get a EEXIST in find_module creating the
# __pycache__ directory and __pycache__ is by some non-dir node.
return False