Page MenuHomeDevCentral

D483.diff
No OneTemporary

D483.diff

diff --git a/create_given_name b/create_given_name
--- a/create_given_name
+++ b/create_given_name
@@ -9,6 +9,7 @@
import argparse
import json
+import os
import pywikibot
import sys
@@ -66,7 +67,8 @@
}
# Gets descriptions from l10n file, and fill labels for these languages.
-l10n_file = l10n_files[genre]
+script_directory = os.path.dirname(os.path.realpath(__file__))
+l10n_file = os.path.join(script_directory, l10n_files[genre])
with open(l10n_file) as data_file:
descriptions = json.load(data_file)
labels = {lang:givenname for lang in descriptions.keys()}
diff --git a/create_surname b/create_surname
--- a/create_surname
+++ b/create_surname
@@ -9,6 +9,7 @@
import argparse
import json
import pywikibot
+import os
# usage: create_surname.py [-h] surname
parser = argparse.ArgumentParser(
@@ -42,7 +43,9 @@
item.get()
# Gets descriptions from l10n file, and fill labels for these languages.
-with open('l10n/surname.json') as data_file:
+script_directory = os.path.dirname(os.path.realpath(__file__))
+l10n_file = os.path.join(script_directory, 'l10n', 'surname.json')
+with open(l10n_file) as data_file:
descriptions = json.load(data_file)
labels = {lang: surname for lang in descriptions.keys()}

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 23, 14:11 (18 h, 28 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2258198
Default Alt Text
D483.diff (1 KB)

Event Timeline