def errormsg(msg):
"""Intended for end-user-visible error messages.
(Currently just writes to stderr with an appended newline, but could do
something better in future: e.g. could add markup to distinguish error
messages from status messages or debugging output.)
Note that this should always be combined with translation:
import inkex
inkex.localize()
...
inkex.errormsg(_("This extension requires two selected paths."))
"""
if isinstance(msg, unicode):
sys.stderr.write(msg.encode("UTF-8") + "\n")
else:
sys.stderr.write((unicode(msg, "utf-8", errors='replace') + "\n").encode("UTF-8"))
评论列表
文章目录