Skip to content

Commit

Permalink
Open license file works well with Windows and Python 2.7 #37
Browse files Browse the repository at this point in the history
  • Loading branch information
raimon49 committed Jul 25, 2019
1 parent 5ce7c08 commit 83be4de
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion piplicenses.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import sys
import glob
import os
import codecs
import argparse
from functools import partial
from email.parser import FeedParser
Expand Down Expand Up @@ -124,7 +125,9 @@ def get_pkg_license_file(pkg):
for test_file in glob.glob(license_file_base):
if os.path.exists(test_file):
license_file = test_file
with open(test_file) as license_file_handle:
with codecs.open(test_file,
encoding='utf-8',
errors='replace') as license_file_handle:
file_lines = license_file_handle.readlines()
try:
# python 3 is happy with maybe-Unicode files
Expand Down

0 comments on commit 83be4de

Please sign in to comment.