Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix a couple of python warnings (#3526)
  • Loading branch information
nirvn authored and m-kuhn committed Sep 23, 2016
1 parent 9900036 commit eefeef5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 3 additions & 1 deletion python/plugins/MetaSearch/util.py
Expand Up @@ -35,6 +35,7 @@
from gettext import gettext, ngettext
import logging
import os
import codecs
import webbrowser
from xml.dom.minidom import parseString
import xml.etree.ElementTree as etree
Expand All @@ -61,7 +62,8 @@ def __init__(self):
"""init"""
self.ppath = os.path.dirname(os.path.abspath(__file__))
self.metadata = configparser.ConfigParser()
self.metadata.readfp(open(os.path.join(self.ppath, 'metadata.txt')))
with codecs.open(os.path.join(self.ppath, 'metadata.txt'), "r", "utf8") as f:
self.metadata.read_file(f)


def get_ui_class(ui_file):
Expand Down
3 changes: 2 additions & 1 deletion python/pyplugin_installer/installer_data.py
Expand Up @@ -580,7 +580,8 @@ def metadataParser(fct):
global errorDetails
cp = configparser.ConfigParser()
try:
cp.read_file(codecs.open(metadataFile, "r", "utf8"))
with codecs.open(metadataFile, "r", "utf8") as f:
cp.read_file(f)
return cp.get('general', fct)
except Exception as e:
if not errorDetails:
Expand Down
5 changes: 2 additions & 3 deletions python/utils.py
Expand Up @@ -254,9 +254,8 @@ def findPlugins(path):
cp = configparser.ConfigParser()

try:
f = codecs.open(metadataFile, "r", "utf8")
cp.read_file(f)
f.close()
with codecs.open(metadataFile, "r", "utf8") as f:
cp.read_file(f)
except:
cp = None

Expand Down

0 comments on commit eefeef5

Please sign in to comment.