mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-13 00:03:09 -04:00
[processing] small fix for non-ascii string (fixes #9175)
This commit is contained in:
parent
1bca310862
commit
d04239d70b
@ -26,6 +26,8 @@ __copyright__ = '(C) 2012, Alexander Bruy'
|
||||
__revision__ = '$Format:%H$'
|
||||
|
||||
import pickle
|
||||
import codecs
|
||||
import sys
|
||||
|
||||
from PyQt4.QtCore import *
|
||||
from PyQt4.QtGui import *
|
||||
@ -152,12 +154,11 @@ class ScriptEditorDialog(QDialog, Ui_DlgScriptEditor):
|
||||
if self.alg is not None:
|
||||
self.alg.script = text
|
||||
try:
|
||||
fout = open(self.filename, 'w')
|
||||
fout.write(text)
|
||||
fout.close()
|
||||
with codecs.open(self.filename, 'w', encoding='utf-8') as fout:
|
||||
fout.write(text)
|
||||
except IOError:
|
||||
QMessageBox.warning(self, self.tr('I/O error'),
|
||||
self.tr('Unable to save edits. Reason:\n %1')
|
||||
self.tr('Unable to save edits. Reason:\n %s')
|
||||
% unicode(sys.exc_info()[1]))
|
||||
return
|
||||
self.update = True
|
||||
|
@ -254,7 +254,7 @@ class ScriptAlgorithm(GeoAlgorithm):
|
||||
out.setValue(ns[out.name])
|
||||
|
||||
def helpFile(self):
|
||||
helpfile = unicode(self.descriptionFile) + '.help'
|
||||
helpfile = self.descriptionFile + '.help'
|
||||
if os.path.exists(helpfile):
|
||||
h2h = Help2Html()
|
||||
return h2h.getHtmlFile(self, helpfile)
|
||||
|
Loading…
x
Reference in New Issue
Block a user