Problems in commands.getoutput(cmd) with sox

bbarbero at bbarbero at
Thu Jul 23 15:23:54 EDT 2009

Hello to all!

I am a new researcher, new to Python as well, and I have a problem,  
when I try to get commands from sox in a python script. I am going  
crazy, because this code has been working before.. so I dont really  
know whats going on..

Ive already seen some solutions that match with what I have. I am  
running this:

         if os.path.splitext(file_au)[1] == ".au":
           	resampled_file_path = os.path.join(resampled_path, file_au)
            	cmd = "sox " + dir_file + " -r 44100 " + resampled_file_path
            	print cmd
		output = commands.getoutput(cmd)
		print output

What i do, is just to resample a song from dir_file to  
resampled_file_path. As a result of "cmd" I get:

sox /Volumes/HAL/Datasets/Audio/gtzan_genres/rock/ -r  

If I run this on the command line, it will work perfectly!

But The program stops at

line 35
     output = commands.getoutput(cmd)
IndentationError: unexpected indent

I dont have any idea, whats going on, I am trying lot of things, but I  
can understand where is the error as it has been running perfectly  

Any suggestions will be more than welcome! Thanks in advance for your help!

Best regards,
Beatriz Mora.

This message was sent using IMP, the Internet Messaging Program.

More information about the Python-list mailing list