Python:os.system x实际命令

用户名

当我直接通过命令行执行以下命令时,它可以正常工作:

mpg321 -a bluetooth Canon.mp3

但是,通过Python执行以下代码:

import os
os.system('mpg321 -a bluetooth Canon.mp3')

我收到以下错误:

ALSA lib pcm.c:2217:(snd_pcm_open_noupdate)未知的PCM蓝牙无法使用设备蓝牙打开libao驱动程序(正在使用设备吗?)

任何想法可能有什么问题吗?谢谢!

算了吧

mpg321错误消息:

无法打开力宝驱动程序

如果用户没有写/ dev / audio的特权,则可能会发生。请参阅Debian SoundFAQ(搜索“无法打开libao”),它指向http://wiki.debian.org/SoundConfiguration作为解决方案,即将用户添加到audio组中。

adduser USER_NAME audio

或者,像OP一样做,并以已经具有正确特权的用户身份运行命令。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

Python os.system:命令顺序

如何告诉Python等待os.system()的Windows命令完成?

Python - 多个 os.system 命令的替代方案

在python中使用os.system()执行linux命令

Python os.system cp命令复制空文件

python 3.4-os.system不执行命令

如何在Mac OS X中修复System Python的权限?

Python执行期望命令不匹配的引号问题:python -c'os.system(“ expect -c ...”)'

python os.system命令行将值返回给python

执行长 OS X 命令,该命令通过 os.system 将脚本作为新行作为参数

多行命令到os.system

如何使用 python 2 在 os.system 命令中转义/使用单引号?

寻找帮助了解os.system()Python行中的sed命令

从python的“ os.system”调用中调用时,会启动两个“ prstat”命令

Python-什么时候可以使用os.system()发出常见的Linux命令

如何在Python中使用'os.system('command')'向CMD发送命令列表

终止Python进程并停止其底层os.system命令行

使用python在os.system的参数中使用一行“找不到命令”

Python os.system 不返回与命令提示符相同的数据

如何在python中列出os.system()中列出的命令?

x的返回值= os.system(..)

Python,os.system和subprocess.call都不适用于可变字符串命令

需要在os.system中的变量与python中的espeak和aplay命令一起使用

如何在编辑器中通过命令 ( os.system (Path) ) 或 (os.startfile(path/Filename)) 打开单个 python 文件(或任何代码文件)?

Python:os.system的输入被拆分

如何从python中的system()命令捕获异常

使用System()从R脚本调用Python命令

Tkinter从os.system命令返回GUI的结果

包裹在os.system中的命令将被忽略