You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by jgewehr <jg...@gmail.com> on 2016/12/28 21:13:06 UTC

Debug exec of python script

I'm trying to figure out why my exec of a python script is failing.  My route
looks like this:

from.("sftp....")
.to("file...")
.to("exec:test.py")
.to("log:foo?showAll");

So I'm transferring a file from an SFTP server to the local filesystem, and
then I want to run a python script on it.  The file transfer is working
fine.  However, my python script is returning an error.  When I look in the
log I see CamelExecStderr=java.io.ByteArrayInputStream@5944a314.  According
to the Exec component page here http://camel.apache.org/exec.html:  

ExecBinding.EXEC_STDERR java.io.InputStream The value of this header points
to the standard error stream (stderr) of the executable.

I just want to print the actual string value of stderr, not
java.io.ByteArrayInputStream@5944a314.  I feel like this should be easy and
I'm missing something.  How do I print the value of the headers on the Exec
component page, for example ExecBinding.EXEC_STDERR or
ExecBinding.EXEC_EXIT_VALUE?

Help?



--
View this message in context: http://camel.465427.n5.nabble.com/Debug-exec-of-python-script-tp5791982.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Debug exec of python script

Posted by jgewehr <jg...@gmail.com>.
I thought I had tried that but I must have gotten the syntax wrong.

Thanks!



--
View this message in context: http://camel.465427.n5.nabble.com/Debug-exec-of-python-script-tp5791982p5791984.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Debug exec of python script

Posted by Quinn Stevenson <qu...@pronoia-solutions.com>.
Did you try logging the headers?

.log( “Stderr: ${header[CamelExecStderr]} )

or

.log( “Exit Value: ${header[CamelExecExitValue]} )

Quinn Stevenson
quinn@pronoia-solutions.com
(801) 244-7758



> On Dec 28, 2016, at 2:13 PM, jgewehr <jg...@gmail.com> wrote:
> 
> I'm trying to figure out why my exec of a python script is failing.  My route
> looks like this:
> 
> from.("sftp....")
> .to("file...")
> .to("exec:test.py")
> .to("log:foo?showAll");
> 
> So I'm transferring a file from an SFTP server to the local filesystem, and
> then I want to run a python script on it.  The file transfer is working
> fine.  However, my python script is returning an error.  When I look in the
> log I see CamelExecStderr=java.io.ByteArrayInputStream@5944a314.  According
> to the Exec component page here http://camel.apache.org/exec.html:  
> 
> ExecBinding.EXEC_STDERR java.io.InputStream The value of this header points
> to the standard error stream (stderr) of the executable.
> 
> I just want to print the actual string value of stderr, not
> java.io.ByteArrayInputStream@5944a314.  I feel like this should be easy and
> I'm missing something.  How do I print the value of the headers on the Exec
> component page, for example ExecBinding.EXEC_STDERR or
> ExecBinding.EXEC_EXIT_VALUE?
> 
> Help?
> 
> 
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/Debug-exec-of-python-script-tp5791982.html
> Sent from the Camel - Users mailing list archive at Nabble.com.