Jump to content

How to move file to linux with ironPython


Anas Abu Sara

Recommended Posts

I'm having a problem while trying to copy a file to FTP server using ironPython script. And the server is Active (not passive).

Running the following code creates a file "output.ppt" on the Linux machine with 0 KB and getting some errors as shown below.

Code:

from ftplib import *

ftp = FTP('') #domain name or server ip:

ftp.login('','')

ftp.cwd('/path/')

ftp.set_pasv(False)

ftp.storbinary('STOR output.pptx', open('C:\test\test.pptx', 'rb'))

 

Error message:

Traceback (most recent call last):

File "", line 6, in

File "C:Program Files (x86)TIBCOSpotfire7.11.0ModulesScript Support_32.1.13113.4496IronPython-2.7Lib.zipftplib.py", line 471, in storbinary

File "C:Program Files (x86)TIBCOSpotfire7.11.0ModulesScript Support_32.1.13113.4496IronPython-2.7Lib.zipftplib.py", line 376, in transfercmd

File "C:Program Files (x86)TIBCOSpotfire7.11.0ModulesScript Support_32.1.13113.4496IronPython-2.7Lib.zipftplib.py", line 358, in ntransfercmd

File "C:Program Files (x86)TIBCOSpotfire7.11.0ModulesScript Support_32.1.13113.4496IronPython-2.7Lib.zipftplib.py", line 249, in sendcmd

File "C:Program Files (x86)TIBCOSpotfire7.11.0ModulesScript Support_32.1.13113.4496IronPython-2.7Lib.zipftplib.py", line 222, in getresp

ftplib.error_temp: 425 Failed to establish connection.

 

 

System.Exception: 425 Failed to establish connection.

at Microsoft.Scripting.Interpreter.ThrowInstruction.Run(InterpretedFrame frame)

at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)

at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1)

at IronPython.Runtime.Method.MethodBinding.SelfTarget(CallSite site, CodeContext context, Object target)

at IronPython.Compiler.Ast.CallExpression.Invoke0Instruction.Run(InterpretedFrame frame)

at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)

at Microsoft.Scripting.Interpreter.LightLambda.Run3[T0,T1,T2,TRet](T0 arg0, T1 arg1, T2 arg2)

at IronPython.Runtime.Method.MethodBinding`1.SelfTarget(CallSite site, CodeContext context, Object target, T0 arg0)

at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2)

at Microsoft.Scripting.Interpreter.FuncCallInstruction`6.Run(InterpretedFrame frame)

at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)

at Microsoft.Scripting.Interpreter.LightLambda.Run4[T0,T1,T2,T3,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3)

at IronPython.Compiler.Ast.CallExpression.Invoke1Instruction.Run(InterpretedFrame frame)

at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)

at Microsoft.Scripting.Interpreter.LightLambda.Run4[T0,T1,T2,T3,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3)

at IronPython.Compiler.PythonCallTargets.OriginalCallTarget3(PythonFunction function, Object arg0, Object arg1, Object arg2)

at IronPython.Runtime.Method.MethodBinding`2.SelfTarget(CallSite site, CodeContext context, Object target, T0 arg0, T1 arg1)

at IronPython.Compiler.Ast.CallExpression.Invoke2Instruction.Run(InterpretedFrame frame)

at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)

at Microsoft.Scripting.Interpreter.LightLambda.Run4[T0,T1,T2,T3,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3)

at IronPython.Compiler.PythonCallTargets.OriginalCallTarget3(PythonFunction function, Object arg0, Object arg1, Object arg2)

at System.Dynamic.UpdateDelegates.UpdateAndExecute5[T0,T1,T2,T3,T4,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4)

at IronPython.Runtime.Method.MethodBinding`2.SelfTarget(CallSite site, CodeContext context, Object target, T0 arg0, T1 arg1)

at System.Dynamic.UpdateDelegates.UpdateAndExecute4[T0,T1,T2,T3,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3)

at Microsoft.Scripting.Interpreter.FuncCallInstruction`7.Run(InterpretedFrame frame)

at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)

at Microsoft.Scripting.Interpreter.LightLambda.Run5[T0,T1,T2,T3,T4,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4)

at IronPython.Compiler.Ast.CallExpression.Invoke2Instruction.Run(InterpretedFrame frame)

at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)

at Microsoft.Scripting.Interpreter.LightLambda.Run7[T0,T1,T2,T3,T4,T5,T6,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6)

at IronPython.Compiler.PythonCallTargets.OriginalCallTarget6(PythonFunction function, Object arg0, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5)

at IronPython.Runtime.FunctionCaller`3.Default3Call3(CallSite site, CodeContext context, Object func, T0 arg0, T1 arg1, T2 arg2)

at System.Dynamic.UpdateDelegates.UpdateAndExecute5[T0,T1,T2,T3,T4,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4)

at IronPython.Runtime.Method.MethodBinding`2.SelfTarget(CallSite site, CodeContext context, Object target, T0 arg0, T1 arg1)

at System.Dynamic.UpdateDelegates.UpdateAndExecute4[T0,T1,T2,T3,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3)

at Microsoft.Scripting.Interpreter.DynamicInstruction`5.Run(InterpretedFrame frame)

at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)

at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1)

at IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx)

at Microsoft.Scripting.Hosting.ScriptSource.Execute(ScriptScope scope)

at Spotfire.Dxp.Application.IronPython27.IronPythonScriptEngine.ExecuteForDebugging(String scriptCode, Dictionary`2 scope, Stream outputStream)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...