ev3dev#1026: Sound.speak does not work with double quotes#443
ev3dev#1026: Sound.speak does not work with double quotes#443dwalton76 merged 4 commits intoev3dev:developfrom
Conversation
|
@ddemidov In ev3dev/ev3dev#1026 (comment) I suggested using https://docs.python.org/3.4/library/shlex.html#shlex.quote; see the conversation there. Thoughts? |
|
@WasabiFan , yes, ev3dev-lang-python/ev3dev/sound.py Line 104 in ee75c5c |
|
Corection: not in the same way, since (note the absence of |
ddemidov
left a comment
There was a problem hiding this comment.
Please see if using shlex would work here
|
Final edit: cmd_line = ['/usr/bin/espeak', '--stdout'] + shlex.split(espeak_opts) + [shlex.quote(text)]
...
play = Popen(args, stdout=n)seems to be more reliable and actually does work: >>> espeak_opts='-a -b -c'
>>> text = 'Hello " world'
>>> cmd_line = ['/usr/bin/espeak', '--stdout'] + shlex.split(espeak_opts) + [shlex.quote(text)]
>>> cmd_line
['/usr/bin/espeak', '--stdout', '-a', '-b', '-c', '\'Hello " world\''] |
|
OK, switched over to shlex and tested on my local EV3 setup. Any verdict on if we wanted shell=True in the Popen calls? |
ddemidov
left a comment
There was a problem hiding this comment.
I think shell=True is not needed if we use shlex.split(). Otherwise, looks good to me.
|
@amandaoneal can you drop the |
|
@amandaoneal there are some conflicts that have to be resolved before we can merge. |
|
Looked like the only merge conflict was that the folder 'ev3dev' got renamed 'ev3dev2'... Sigh. Should be back in good shape now. |
No description provided.