This is really the day of the spaces for me. After several frustrating experiences with Un*x/Linux (no spaces in the shebang line) and virtualenv (also a spaces related bug) I finally found a software I can fix ;-)

Shortly after applying my last patch I found that the completion server won't start either. Patch attached, still a bit rough. I had to use hg in order to get a nice (and clean) patch so you have to apply it to org.python.pydev and use p1.

--
Felix Schwarz
Dipl.-Informatiker

Gubener Str. 38
10243 Berlin
Germany

www.schwarz.eu - software development and consulting

diff -r 8ada99d82270 src/org/python/pydev/runners/SimplePythonRunner.java
--- a/src/org/python/pydev/runners/SimplePythonRunner.java	Mon May 12 02:16:16 2008 +0200
+++ b/src/org/python/pydev/runners/SimplePythonRunner.java	Mon May 12 02:30:02 2008 +0200
@@ -41,8 +41,8 @@ public class SimplePythonRunner extends 
      * @return a string with the output of the process (stdout)
      */
     public Tuple<String,String> runAndGetOutput(String script, String[] args, File workingDir, IProject project) {
-        String executionString = makeExecutableCommandStr(script, args);
-        return runAndGetOutput(executionString, workingDir, project);
+    	String[] parameters = addInterpreterToArgs(script, args);
+        return runAndGetOutput(parameters, workingDir, project);
     }
 
     /**
@@ -51,10 +51,14 @@ public class SimplePythonRunner extends 
      * @return the string with the command to run the passed script with jython
      */
     public static String makeExecutableCommandStr(String script, String[] args) {
-        String interpreter = PydevPlugin.getPythonInterpreterManager().getDefaultInterpreter();
-		String[] s = preparePythonCallParameters(interpreter, script, args);
+        String[] s = addInterpreterToArgs(script, args);
         return getCommandLineAsString(s, args);
     }
+
+	private static String[] addInterpreterToArgs(String script, String[] args) {
+		String interpreter = PydevPlugin.getPythonInterpreterManager().getDefaultInterpreter();
+		return preparePythonCallParameters(interpreter, script, args);
+	}
 
     /**
      * Execute the string and format for windows if we have spaces...
diff -r 8ada99d82270 src/org/python/pydev/runners/SimpleRunner.java
--- a/src/org/python/pydev/runners/SimpleRunner.java	Mon May 12 02:16:16 2008 +0200
+++ b/src/org/python/pydev/runners/SimpleRunner.java	Mon May 12 02:30:02 2008 +0200
@@ -37,6 +37,10 @@ public abstract class SimpleRunner {
      */
     public Process createProcess(String executionString, File workingDir) throws IOException {
         return Runtime.getRuntime().exec(executionString, null, workingDir);
+    }
+
+    public Process createProcess(String[] parameters, File workingDir) throws IOException {
+        return Runtime.getRuntime().exec(parameters, null, workingDir);
     }
 
     /**
@@ -296,6 +300,10 @@ public abstract class SimpleRunner {
         return runAndGetOutput(executionString, workingDir, project, new NullProgressMonitor());
     }
     
+    public Tuple<String,String>  runAndGetOutput(String[] arguments, File workingDir, IProject project) {
+        return runAndGetOutput(arguments, workingDir, project, new NullProgressMonitor());
+    }
+    
     /**
      * shortcut
      */
diff -r 8ada99d82270 src_completions/org/python/pydev/editor/codecompletion/shell/PythonShell.java
--- a/src_completions/org/python/pydev/editor/codecompletion/shell/PythonShell.java	Mon May 12 02:16:16 2008 +0200
+++ b/src_completions/org/python/pydev/editor/codecompletion/shell/PythonShell.java	Mon May 12 02:30:02 2008 +0200
@@ -48,7 +48,8 @@ public class PythonShell extends Abstrac
         }else{ //however in mac, or linux, this gives an error...
             execMsg = interpreter+" "+REF.getFileAbsolutePath(serverFile)+" "+pWrite+" "+pRead;
         }
-        process = new SimplePythonRunner().createProcess(execMsg, serverFile.getParentFile());
+        String[] parameters = {interpreter, REF.getFileAbsolutePath(serverFile), ""+pWrite, ""+pRead};
+        process = new SimplePythonRunner().createProcess(parameters, serverFile.getParentFile());
 
         return execMsg;
     }
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
pydev-code mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pydev-code

Reply via email to