i am developing a coffeescript which needs to execute a python program and get the responses from the python code. my coffee script is
module.exports = (robot) ->
robot.respond /greetme/i, (msg) ->
sender = msg.message.user.name.toLowerCase()
@exec = require('child_process').exec
command = "python3 ext-scripts/hello.py"
@exec command, (out1) ->
msg.send out1
msg.send "Hello " + sender
msg.finish()
and my python code is hello.py
print("hey indhu")
return "reached the python file"
i need to get the output "reached the python file" to 6th line in coffee script. to send out the message
i am getting error while doing this exec out function.
message: Error: Command failed: python3 ext-scripts/hello.py File "ext-scripts/hello.py", line 28 return "reached the python file" ^ SyntaxError: 'return' outside function
error: Response not OK: no_text
How to make it work. please help me . i am a python developer and new to coffeescript.