
from __future__ import print_function

import sys
import os
import subprocess


def main():
    command = sys.argv[3:]
    env = dict(os.environ, PYTHONPATH=sys.argv[2])
    with open(sys.argv[1], 'w') as f:
        f.write(subprocess.check_output(command, env=env))
    

if __name__ == '__main__':
    main()


from __future__ import print_function

import sys
import os
import subprocess


def main():
    command = sys.argv[3:]
    env = dict(os.environ, PYTHONPATH=sys.argv[2])
    with open(sys.argv[1], 'w') as f:
        f.write(subprocess.check_output(command, env=env).decode("utf-8"))


if __name__ == '__main__':
    main()

Add support for Python 3
Add support for Python 3
  
  from __future__ import print_function
  
  import sys
  import os
  import subprocess
  
  
  def main():
      command = sys.argv[3:]
      env = dict(os.environ, PYTHONPATH=sys.argv[2])
      with open(sys.argv[1], 'w') as f:
-         f.write(subprocess.check_output(command, env=env))
+         f.write(subprocess.check_output(command, env=env).decode("utf-8"))
-     
+ 
  
  if __name__ == '__main__':
      main()
  
Add support for Python 3
## Code Before:

from __future__ import print_function

import sys
import os
import subprocess


def main():
    command = sys.argv[3:]
    env = dict(os.environ, PYTHONPATH=sys.argv[2])
    with open(sys.argv[1], 'w') as f:
        f.write(subprocess.check_output(command, env=env))
    

if __name__ == '__main__':
    main()

## Instruction:
Add support for Python 3
## Code After:

from __future__ import print_function

import sys
import os
import subprocess


def main():
    command = sys.argv[3:]
    env = dict(os.environ, PYTHONPATH=sys.argv[2])
    with open(sys.argv[1], 'w') as f:
        f.write(subprocess.check_output(command, env=env).decode("utf-8"))


if __name__ == '__main__':
    main()
