0

I want to use Sublime Text in Ubuntu for python programming and want to write a build system that takes input from a mentioned file and prints output to other mentioned file. I have done same for c++ using this code :

{
    "cmd": ["g++ -std=c++11 ${file} -o ${file_path}/${file_base_name} && ${file_path}/${file_base_name}<${file_path}/inputf.in>${file_path}/outputf.in"],
    "shell" : true
}
J. Chomel
  • 8,193
  • 15
  • 41
  • 69
Tushar
  • 51
  • 5

2 Answers2

0

Tushar found the solution for himself by modifying the above code like below:

{
    "cmd": ["python ${file}<${file_path}/inputf.in>${file_path}/outputf.in"],
    "shell":true
}
J. Chomel
  • 8,193
  • 15
  • 41
  • 69
0

Just in case if somebody is seeking a solution to the same problem in Windows. A few changes to the answer suggested by J.Chomel. will do the work. But first, Save your input and output files in the same folder you are working.

{
"cmd": ["python", "${file}","<inputf.in>outputf.in"],
"shell":true,
"working_dir":"$file_path",
}

This is by far the fastest way to run a python file taking the input from a file and saving the output in a file for me. Seriously. :)

Amit Dwivedi
  • 91
  • 1
  • 3