On Friday, 24 February 2017 15:43:04 GMT Ralph Corderoy wrote:

Ralph,

Thanks for all your help on the subprocess stuff.  I'm sure I have a way 
forward now.

In the meantime, I've been trying to get the MP3 Player to work.  From your 
original suggestions:

>     playlists = ('daisy', 'peal', 'vikings', 'march', 'fugue')

Are these intended to be just names or should they link in some way to the 
files to be played.  I've assumed the latter, but when I add the path it still 
doesn't work (that may be because of an earlier error, see below).

>         r = subprocess.call(...mpg321..., 'announce-' +
> playlists[playlist_index])

I originally assumed that your ...mpg321..., was intended to represent the 
code need to get the mpg player to play to the right place etc, so I 
substituted my own code there (see below).  After I got a runtime error. I 
tried it as written and got a syntax error and when I put mpg321 into quotes, 
I got the following runtime error:

        TypeError: bufsize must be an integer

I've tried running it in the IDLE Debugger, but that doesn't really help me 
(it might someone else who actually understood the Debugger output).

However, here is an example of a subprocess.call() from my program that 
actually works:

        subprocess.call(['mpg321', '-q', '-m', '-m', '-a', 'hw:0,0', 
fchimes_path]) 

Where fchimes_path is assembled from the filename and the directory path using 
os.path.join().

The thing is that each of the strings in quotation marks after the element 
containing mpg321 are options to it.  However, 'announce' isn't  a valid 
option, so is that what is causing the error?  If so, what is it trying to do?  
Is that another representation of something?  It was at this point that I was 
intending to play a short mp3 file to announce the identity of the current 
playlist.

Also, and related to my first question; in your invocation, I'm assuming that 
the playlists[playlist_index] element is intended to cycle through the files in 
the playlist directory (see my first question).  Will it do this forever (until 
terminated) or only once?

-- 



                Terry Coles

-- 
Next meeting:  Bournemouth, Tuesday, 2017-03-07 20:00
Meets, Mailing list, IRC, LinkedIn, ...  http://dorset.lug.org.uk/
New thread:  mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING
Reporting bugs well:  http://goo.gl/4Xue     / TO THE LIST OR THE AUTHOR

Reply via email to