Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3765773
D483.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D483.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D483: Allow to run commands outside the script directory
Attached
Detach File
Event Timeline
Log In to Comment