Skip to content

Commit

Permalink
fix: WindowsError keyword is undefined on non-Windows platforms (#117)
Browse files Browse the repository at this point in the history
WindowsError is a subclass of `OSError`. It is defined and raised only
in Windows. Hence the exception statement will return a
`WindowsError keyword is undefined` in other platforms.

Usually this error is encountered when CodeUri: /folder/does/not/exist. The builder tries to copy the files and fails because the path does not exist. On Windows, the exception handler works, but on Mac/Linux Python interpreter does not find the variable WindowsError and crashes. So it leads to a vague WindowsError on Mac/Linux.
  • Loading branch information
sanathkr authored Jun 7, 2019
1 parent 6696532 commit df3b9d8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion aws_lambda_builders/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def copytree(source, destination, ignore=None):
try:
# Let's try to copy the directory metadata from source to destination
shutil.copystat(source, destination)
except WindowsError as ex: # pylint: disable=undefined-variable
except OSError as ex:
# Can't copy file access times in Windows
LOG.debug("Unable to copy file access times from %s to %s", source, destination, exc_info=ex)

Expand Down

0 comments on commit df3b9d8

Please sign in to comment.