Sublime Forum

How to correctly redirect console io in build system

#1

Hello,

I am trying to create a simple build system for python files. I can’t figure out how to redirect console i/o with the > or < operators.

What I want: Pressing Ctrl + B should execute this shell command (works correctly when run in the Terminal from the working directory)

python -u myfile.py < myfile_ip.txt > myfile_op.txt

My current build:

{ "cmd": "python", "-u", "$file_name", "<", "${file_base_name}_ip.txt", ">", "${file_base_name}_op.txt"], "working_dir": "$file_path" }

On pressing build, the console output says “Running python -u myfile.py < myfile_ip.txt > myfile_op.txt”. But the program doesn’t read the input correctly.

I’ve already tried the solution posted in https://forum.sublimetext.com/t/problem-creating-a-new-build-system-solved/9853/1&hilit=build+system+redirect+output, but it didn’t work for me. I could not get it to redirect just the output either… I’m probably missing something very basic, it’s my first time trying the build system.

[Using ST 3 Build 3065 on Ubuntu 12.10 x64]

Please help. Thanks!

0 Likes