mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
fix a couple of python warnings (#3526)
This commit is contained in:
parent
9900036989
commit
eefeef573d
@ -35,6 +35,7 @@ import configparser
|
||||
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
|
||||
@ -61,7 +62,8 @@ class StaticContext(object):
|
||||
"""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):
|
||||
|
@ -580,7 +580,8 @@ class Plugins(QObject):
|
||||
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:
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user