Problems in commands.getoutput(cmd) with sox
MRAB
python at mrabarnett.plus.com
Thu Jul 23 17:25:39 EDT 2009
bbarbero at inescporto.pt wrote:
> 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
^ extra indent
> 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/rock.00097.au -r 44100
> /Volumes/bmorab/Audio_Projecto/Data/gtzan_genres/resampled/rock/rock.00097.au
>
> .....
>
> If I run this on the command line, it will work perfectly!
>
> But The program stops at
>
> File
> "/Volumes/bmorab/Audio_Projecto/Data/gtzan_genres/resamplingto44.py",
> 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 before.
>
> Any suggestions will be more than welcome! Thanks in advance for your help!
>
You need to double-check the indentation.
More information about the Python-list
mailing list