Repository: cloudslang/cloud-slang
Issue: Python action - Cannot import svn.local

When trying to import in an action python script, we get:

```
Command failed java.lang.RuntimeException: Slang Error : Error executing python script: Traceback (most recent call last):
  File "<string>", line 2, in <module>
  File "C:\\Users\\stoneo\\Desktop\\Cslang-0.8-rc-1\\cslang\\python-lib\\svn\\local.py", line 4, in <module>
    import svn.common
  File "C:\\Users\\stoneo\\Desktop\\Cslang-0.8-rc-1\\cslang\\python-lib\\svn\\common.py", line 4, in <module>
    import dateutil.parser
  File "C:\\Users\\stoneo\\Desktop\\Cslang-0.8-rc-1\\cslang\\python-lib\\dateutil\\parser.py", line 22, in <module>
    from io import StringIO
ImportError: cannot import name StringIO
```

If we first import in our script StringIO from io nmaually, it works:

``` python
      from io import StringIO
      import svn.local
```


Changed files:
cloudslang-runtime/src/test/java/io/cloudslang/lang/runtime/steps/ActionStepsTest.java
cloudslang-runtime/src/main/java/io/cloudslang/lang/runtime/configuration/SlangRuntimeSpringConfig.java

diff --git a/cloudslang-runtime/src/main/java/io/cloudslang/lang/runtime/configuration/SlangRuntimeSpringConfig.java b/cloudslang-runtime/src/main/java/io/cloudslang/lang/runtime/configuration/SlangRuntimeSpringConfig.java
index e624944e9..511ddabab 100644
--- a/cloudslang-runtime/src/main/java/io/cloudslang/lang/runtime/configuration/SlangRuntimeSpringConfig.java
+++ b/cloudslang-runtime/src/main/java/io/cloudslang/lang/runtime/configuration/SlangRuntimeSpringConfig.java
@@ -30,7 +30,10 @@ public class SlangRuntimeSpringConfig {
 
     @Bean
     public PythonInterpreter interpreter(){
-        return new PythonInterpreter();
+        PythonInterpreter interpreter = new PythonInterpreter();
+//        here to avoid jython preferring io.cloudslang package over python io package
+        interpreter.exec("import io");
+        return interpreter;
     }
 
     @Bean
diff --git a/cloudslang-runtime/src/test/java/io/cloudslang/lang/runtime/steps/ActionStepsTest.java b/cloudslang-runtime/src/test/java/io/cloudslang/lang/runtime/steps/ActionStepsTest.java
index e18581a81..4a5d81735 100644
--- a/cloudslang-runtime/src/test/java/io/cloudslang/lang/runtime/steps/ActionStepsTest.java
+++ b/cloudslang-runtime/src/test/java/io/cloudslang/lang/runtime/steps/ActionStepsTest.java
@@ -489,6 +489,23 @@ public class ActionStepsTest {
         actionSteps.doAction(runEnv, nonSerializableExecutionData, PYTHON, "", "", executionRuntimeServicesMock, userPythonScript, 2L);
     }
 
+
+    @Test
+    public void doActionPythonImportRightIOPackage() {
+        //prepare doAction arguments
+        RunEnvironment runEnv = new RunEnvironment();
+
+        String userPythonScript =
+                "import io\\n" +
+                "if 'StringIO' not in dir(io):\\n" +
+                "  raise Exception('cant find StringIO')";
+
+        //invoke doAction
+        actionSteps.doAction(
+                runEnv, new HashMap<String, Object>(), PYTHON, "", "",
+                executionRuntimeServicesMock, userPythonScript, 2L);
+    }
+
     @Test (expected = RuntimeException.class, timeout = DEFAULT_TIMEOUT)
     public void doActionPythonInputTypeMismatchTest() {
         //prepare doAction arguments