I am trying to run the following in a cocoa app:
cat PATHTOFILE | python -mjson.tool > OUTPUTFILE
NSTask *task = [[NSTask alloc] init];
[task setLaunchPath: @"/bin/cat"];
NSArray *arguments = [NSArray arrayWithObject: path];
[task setArguments: arguments];
NSPipe *pipe = [NSPipe pipe];
[task setStandardOutput:pipe];
[task launch];
NSTask *task2 = [[NSTask alloc] init];
[task2 setLaunchPath:@"/usr/bin/python"];
NSArray *arguments2 = [NSArray arrayWithObject:[NSString stringWithFormat:@"-mjson.tool > %@.beautify", path]];
[task2 setArguments:arguments2];
[task2 setStandardInput:pipe];
NSPipe *pipe2 = [NSPipe pipe];
[task2 setStandardOutput:pipe2];
[task2 launch];
However I am getting the following error: /usr/bin/python: Import by filename is not supported.
Any ideas?