You are not logged in.
Hi Friends. I am writing a python3 script for audacious to check the internet for album cover of the current playing song and then display it in conky. I am trying to call a command from python and get it's output:
audtool current-song-tuple-data album
but when i use this command in python like this:
subprocess.check_output(["audtool", "current-song-tuple-data album"])
i get the following error:
Unknown command "current-song-tuple-data album". Try "audtool help".
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.2/subprocess.py", line 522, in check_output
raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '['audtool', 'current-song-tuple-data album']' returned non-zero exit status 1
Please , python experts on this forum, help me.
Using Openbox + Tint2 + Idesk
Offline
@Pranavg1890 Please read the error message. You need to put each argument into a separate list item.
Offline
@lunar can you please elaborate your point by showing me how should i write? Many Thanks for reply.
Using Openbox + Tint2 + Idesk
Offline
subprocess.check_output(["audtool", "current-song-tuple-data", "album"])
In Zen they say: If something is boring after two minutes, try it for four. If still boring, try it for eight, sixteen, thirty-two, and so on. Eventually one discovers that it's not boring at all but very interesting.
~ John Cage
Offline
@Nisstyre56 Many Thanks . It Worked.
Using Openbox + Tint2 + Idesk
Offline
@Pranavg1890: Please add solved to your thread title then.
BTW: I found pexpect a good option for interacting with shell commands:
http://sourceforge.net/projects/pexpect/
It provides an easy way to deal with console output and react on certain patterns.
My archlinux x86_64 host:
AMD E350 (2x1.6GHz) / 8GB DDR3 RAM / GeForce 9500GT (passive) / Arch running from 16GB USB Stick
Offline