Skip to content

Instantly share code, notes, and snippets.

@priyankajayaswal1
Last active August 29, 2015 14:18
Show Gist options
  • Save priyankajayaswal1/68b7f230de3b50143fd0 to your computer and use it in GitHub Desktop.
Save priyankajayaswal1/68b7f230de3b50143fd0 to your computer and use it in GitHub Desktop.
diff --git a/scripts/replace.py b/scripts/replace.py
index 56fcab5..c8f16d0 100644
--- a/scripts/replace.py
+++ b/scripts/replace.py
@@ -803,13 +803,15 @@ def main(*args):
if replacement_file:
try:
with codecs.open(replacement_file, 'r', 'utf-8') as f:
- commandline_replacements.extend(
- line.lstrip(u'\uFEFF').rstrip('\r\n') for line in f)
+ lines = f.readlines()
except (IOError, OSError) as e:
pywikibot.error('Error loading {0}: {1}'.format(
replacement_file, e))
return False
+ commandline_replacements.extend(
+ line.lstrip(u'\uFEFF').rstrip('\r\n') for line in lines)
+
if len(commandline_replacements) % 2:
pywikibot.error(
'{0} contains an incomplete pattern replacement pair.'.format(
(END)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment