Import shlex from the beginning

master
Guillaume Seguin 2013-05-18 17:18:20 +02:00
parent 97f7635fbd
commit a4759865ba
1 changed files with 1 additions and 2 deletions

View File

@ -26,6 +26,7 @@ except:
print _("WX is not installed. This program requires WX to run.") print _("WX is not installed. This program requires WX to run.")
raise raise
import sys, glob, time, datetime, threading, traceback, cStringIO, subprocess import sys, glob, time, datetime, threading, traceback, cStringIO, subprocess
import shlex
from printrun.pronterface_widgets import * from printrun.pronterface_widgets import *
from serial import SerialException from serial import SerialException
@ -223,7 +224,6 @@ class PronterWindow(MainWindow, pronsole.pronsole):
param = self.settings.final_command param = self.settings.final_command
if not param: if not param:
return return
import shlex
pararray = [i.replace("$s", str(self.filename)).replace("$t", format_duration(print_duration)).encode() for i in shlex.split(param.replace("\\", "\\\\").encode())] pararray = [i.replace("$s", str(self.filename)).replace("$t", format_duration(print_duration)).encode() for i in shlex.split(param.replace("\\", "\\\\").encode())]
self.finalp = subprocess.Popen(pararray, stderr = subprocess.STDOUT, stdout = subprocess.PIPE) self.finalp = subprocess.Popen(pararray, stderr = subprocess.STDOUT, stdout = subprocess.PIPE)
@ -1190,7 +1190,6 @@ class PronterWindow(MainWindow, pronsole.pronsole):
def skein_func(self): def skein_func(self):
try: try:
import shlex
param = self.expandcommand(self.settings.slicecommand).encode() param = self.expandcommand(self.settings.slicecommand).encode()
print "Slicing: ", param print "Slicing: ", param
pararray = [i.replace("$s", self.filename).replace("$o", self.filename.replace(".stl", "_export.gcode").replace(".STL", "_export.gcode")).encode() for i in shlex.split(param.replace("\\", "\\\\").encode())] pararray = [i.replace("$s", self.filename).replace("$o", self.filename.replace(".stl", "_export.gcode").replace(".STL", "_export.gcode")).encode() for i in shlex.split(param.replace("\\", "\\\\").encode())]