Mohi Indharan Mohi Indharan - 1 year ago 63
Python Question

problems with showing a unexpected error

i wrote this function a while ago it was working for a while then this happened help me

track is mp3 file cmd converts mp3 into temp.wav file

def convertwmv(track):
oname = 'temp.wav'
cmd='lame --decode {0} {1}'.format( track,oname )
return data


sh: 1: Syntax error: "(" unexpected

File "/home/mako/.local/lib/python3.5/site-packages/scipy/io/", line 233, in read
fid = open(filename, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: 'temp.wav'

Answer Source

Apparently the track name you are using might be having some brackets in it's file name. bash commands don't deal well with special characters and spaces. Try to escape them before formatting your cmd variable. It became apparent after your last edit.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download