Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log and ignore when meet unknown encoding file #76

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions licenseheaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ def parse_command_line(argv):
"File permissions are restored after successful header injection.")
arguments = parser.parse_args(argv[1:])

# Sets log level to WARN going more verbose for each new -V.
# Sets log level to WARN going more verbose for each new -v.
loglevel = max(4 - arguments.verbose_count, 1) * 10
global LOGGER
LOGGER.setLevel(loglevel)
Expand Down Expand Up @@ -802,7 +802,6 @@ def open_as_writable(file, arguments):

def main():
"""Main function."""
# LOGGER.addHandler(logging.StreamHandler(stream=sys.stderr))
# init: create the ext2type mappings
arguments = parse_command_line(sys.argv)
additional_extensions = arguments.additional_extensions
Expand Down Expand Up @@ -929,7 +928,11 @@ def main():
if arguments.exclude and any([fnmatch.fnmatch(file, pat) for pat in arguments.exclude]):
LOGGER.info("Ignoring file {}".format(file))
continue
finfo = read_file(file, arguments, type_settings)
try:
finfo = read_file(file, arguments, type_settings)
except Exception as e:
LOGGER.error("Exceptions when reading file %s, error=%s", file, e)
finfo = None
if not finfo:
LOGGER.debug("File not supported %s", file)
continue
Expand Down