Fix some potential encoding issues
Might be a fix for #1884, can't be confirmed though, ticket is incomplete.
This commit is contained in:
parent
c69ef1598a
commit
cda48f3b71
1 changed files with 13 additions and 5 deletions
|
|
@ -17,6 +17,7 @@ import octoprint.slicing
|
|||
import octoprint.settings
|
||||
|
||||
from octoprint.util.paths import normalize as normalize_path
|
||||
from octoprint.util import to_unicode
|
||||
|
||||
from .profile import Profile
|
||||
from .profile import GcodeFlavors
|
||||
|
|
@ -236,7 +237,8 @@ class CuraPlugin(octoprint.plugin.SlicerPlugin,
|
|||
|
||||
self._save_profile(path, new_profile, allow_overwrite=allow_overwrite)
|
||||
|
||||
def do_slice(self, model_path, printer_profile, machinecode_path=None, profile_path=None, position=None, on_progress=None, on_progress_args=None, on_progress_kwargs=None):
|
||||
def do_slice(self, model_path, printer_profile, machinecode_path=None, profile_path=None, position=None,
|
||||
on_progress=None, on_progress_args=None, on_progress_kwargs=None):
|
||||
try:
|
||||
with self._job_mutex:
|
||||
if not profile_path:
|
||||
|
|
@ -258,7 +260,10 @@ class CuraPlugin(octoprint.plugin.SlicerPlugin,
|
|||
if not on_progress_kwargs:
|
||||
on_progress_kwargs = dict()
|
||||
|
||||
self._cura_logger.info(u"### Slicing %s to %s using profile stored at %s" % (model_path, machinecode_path, profile_path))
|
||||
self._cura_logger.info(u"### Slicing {} to {} using profile stored at {}"
|
||||
.format(to_unicode(model_path, errors="replace"),
|
||||
to_unicode(machinecode_path, errors="replace"),
|
||||
to_unicode(profile_path, errors="replace")))
|
||||
|
||||
executable = normalize_path(self._settings.get(["cura_engine"]))
|
||||
if not executable:
|
||||
|
|
@ -293,7 +298,9 @@ class CuraPlugin(octoprint.plugin.SlicerPlugin,
|
|||
args += ["-s", "%s=%s" % (k, str(v))]
|
||||
args += ["-o", machinecode_path, model_path]
|
||||
|
||||
self._logger.info(u"Running %r in %s" % (" ".join(args), working_dir))
|
||||
self._logger.info(u"Running {!r} in {}".format(u" ".join(map(lambda x: to_unicode(x, errors="replace"),
|
||||
args)),
|
||||
working_dir))
|
||||
|
||||
import sarge
|
||||
p = sarge.run(args, cwd=working_dir, async=True, stdout=sarge.Capture(), stderr=sarge.Capture())
|
||||
|
|
@ -314,7 +321,7 @@ class CuraPlugin(octoprint.plugin.SlicerPlugin,
|
|||
p.commands[0].poll()
|
||||
continue
|
||||
|
||||
line = octoprint.util.to_unicode(line, errors="replace")
|
||||
line = to_unicode(line, errors="replace")
|
||||
self._cura_logger.debug(line.strip())
|
||||
|
||||
if on_progress is not None:
|
||||
|
|
@ -437,7 +444,8 @@ class CuraPlugin(octoprint.plugin.SlicerPlugin,
|
|||
command = self._slicing_commands[machinecode_path]
|
||||
if command is not None:
|
||||
command.terminate()
|
||||
self._logger.info(u"Cancelled slicing of %s" % machinecode_path)
|
||||
self._logger.info(u"Cancelled slicing of {}"
|
||||
.format(to_unicode(machinecode_path, errors="replace")))
|
||||
|
||||
def _load_profile(self, path):
|
||||
import yaml
|
||||
|
|
|
|||
Loading…
Reference in a new issue