Skip to content
Permalink
Browse files

BF: Create list of string args for subprocess so no string split needed

Splitting the string for the args param in subprocess was causing filenames
with spaces to be split at the space. This fix creates the list of
strings of required commands so no string split method is needed. Part fix
for https://discourse.psychopy.org/t/new-release-3-2-0/8931/7
  • Loading branch information...
dvbridges committed Sep 3, 2019
1 parent 20f901b commit bf4d670ef0e3e35ae9fced9555c138689d031776
Showing with 3 additions and 3 deletions.
  1. +3 −3 psychopy/app/builder/builder.py
@@ -2180,7 +2180,7 @@ def runFile(self, event=None):

if sys.platform == 'win32':
# the quotes allow file paths with spaces
command = '%s -u %s' % (sys.executable, fullPath)
command = [sys.executable, '-u', fullPath]
# self.scriptProcessID = wx.Execute(command, wx.EXEC_ASYNC,
# self.scriptProcess)
if hasattr(wx, "EXEC_NOHIDE"):
@@ -2193,7 +2193,7 @@ def runFile(self, event=None):
# for unix this signifies a space in a filename
pythonExec = sys.executable.replace(' ', '\ ')
# the quotes would break a unix system command
command = '%s -u %s' % (pythonExec, fullPath)
command = [pythonExec, '-u', fullPath]
_opts = wx.EXEC_ASYNC | wx.EXEC_MAKE_GROUP_LEADER
# update app controls
self.toolbar.EnableTool(self.bldrBtnRun.Id, False)
@@ -2202,7 +2202,7 @@ def runFile(self, event=None):
# the whileRunning method will check on stdout from the script
self._processEndTime = None
self.scriptProcess = subprocess.Popen(
args=command.split(),
args=command,
bufsize=1, executable=None, stdin=None,
stdout=subprocess.PIPE, stderr=subprocess.PIPE, preexec_fn=None,
shell=False, cwd=None, env=None,

0 comments on commit bf4d670

Please sign in to comment.
You can’t perform that action at this time.