I have a script managing mpc-commands with python3. I use subprocess.check_output to get information:
s = (subprocess.check_output("mpc current -f %title%", shell=True,encoding = 'utf-8'))
That works well and gives me the value as a string.
Trying to install a service for the script fails with the error:
File "/usr/lib/python2.7/subprocess.py", line 216, in check_output
process = Popen(stdout=PIPE, *popenargs, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'encoding'
Same result (working script, failing service) with 'text = true' instead of 'encoding = 'utf8''.
Why is python2.7 used for subprocess instead of python3? In the seccond line of the script I have
# -*- coding: utf-8 -*-
Version of Python is 3.7.3