I am calling a Python script from TCL.
My requirement is , the Python script should return a list to the TCL. In TCL I should be able to collect the returned list from Python
Below is my TCL script:
#!/usr/bin/env tclsh8.4
set py_script /home/user/ret_list.py
puts [exec $py_script]
#set r = exec $py_script
#puts "$r"
Python script:
#!/usr/bin/python
print ("This is python script")
def func(fruits):
return fruits
fruits = ["mango", "apple"]
func(fruits)
From my TCL script when I am calling the python script by puts [exec $py_script] , it is working. But if I want to collect the return value in below lines which are commented out, it is not working.
Kindly help.
Thanks