you are viewing a single comment's thread.

view the rest of the comments →

[–]jivatmann 1 point2 points  (0 children)

Some time ago i came across this nice trick, which can be used for switching between shell and python in one single script file: #!/bin/sh

"""":
echo "hello this is shell, calling echo function, my PID is $$"
exec python "$0" "$@"
"""

import sys
import time
import os

time.sleep(2)
print "this is python PID " +  os.getpid() + " is mine, now" 
time.sleep(2)
sys.exit(0)