From: Thomas H. <th...@py...> - 2002-11-08 08:53:19
|
"Michael Sorich" <mik...@ho...> writes: > Hi, > > I have just started to use PythonCard. Just thought you may want to know > about a bug/problem I may have found. > > My python path is c:\program files\python22 and when I tried to run > scripts from the editors (eg CodeEditor) they would not work, because > there was a space in the path. > > In the runScript function of the editor files, if I change > os.spawnv(os.P_NOWAIT, python, [python, '-i', filename] + args) > to > os.spawnv(os.P_NOWAIT, python, ['"'+python+'"', '-i', filename] + args) > the scripts run (eg line 1017 in CodeEditor.py) > > Let me know if there is a better way to fix this. IIRC, we once had the same problem in distutils running external programs. The solution, which seems to work, is to enclose the program pathname in double quotes *only* when it contains spaces. Something like if ' ' in python: os.spawnv(os.P_NOWAIT, python, ['"'+python+'"', '-i', filename] + args) else os.spawnv(os.P_NOWAIT, python, [python, '-i', filename] + args) should probably work. Thomas |