Tim Dudgeon created CAMEL-7582:
----------------------------------

             Summary: Python scripts with multiple statements return null
                 Key: CAMEL-7582
                 URL: https://issues.apache.org/jira/browse/CAMEL-7582
             Project: Camel
          Issue Type: Bug
          Components: camel-language
    Affects Versions: 2.13.0
            Reporter: Tim Dudgeon
            Priority: Minor


As reported here: 
http://camel.465427.n5.nabble.com/Return-Value-from-Python-Script-Not-In-Message-Body-tt5724056.html#none

It seems that when calling python script that has more than a single statement  
the return value from the script is null. Here is a simple example in groovy 
that  shows this:

{code}
package com.im.examples

import org.apache.camel.*
import org.apache.camel.impl.*
import org.apache.camel.builder.*

String script = URLEncoder.encode('"Hello world!"', "UTF-8") // this works - 
script returns "Hello world!"
//String script = URLEncoder.encode('bar = "baz"; "Hello world!"', "UTF-8") // 
this fails - script returns null

CamelContext camelContext = new DefaultCamelContext()
camelContext.addRoutes(new RouteBuilder() {
        def void configure() {
            from("direct:python")
            .to("language:python:" + script)
        }
    }
)

camelContext.start()

ProducerTemplate t = camelContext.createProducerTemplate()
def result = t.requestBody('direct:python', 'foo')
println result

camelContext.stop()
{code}





--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to