[ocrfeeder/iso_codes: 1/2] util: Use os.path.join to join dirs in the getLanguages function



commit 83c512a1b82f1348526fe93e46e8ec7a77755f3d
Author: Joaquim Rocha <me joaquimrocha com>
Date:   Sat Apr 18 22:25:32 2020 +0200

    util: Use os.path.join to join dirs in the getLanguages function
    
    It was simply concatenating the paths, but we will soon be able to
    configure the ISO_CODES_PATH, so using os.path.join is safer.

 src/ocrfeeder/util/lib.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/src/ocrfeeder/util/lib.py b/src/ocrfeeder/util/lib.py
index 4b137e5..b1c7767 100644
--- a/src/ocrfeeder/util/lib.py
+++ b/src/ocrfeeder/util/lib.py
@@ -248,7 +248,7 @@ languages = {}
 def getLanguages():
     global languages
     if not languages:
-        root = etree.parse(ISO_CODES_PATH + 'iso_639.xml')
+        root = etree.parse(os.path.join(ISO_CODES_PATH, 'iso_639.xml'))
         for element in root.findall('.//iso_639_entry[@iso_639_1_code]'):
             languages[element.get('iso_639_1_code')] = element.get('name')
     return languages


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]