Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/355.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Subprocess.Popen参数未传递给新进程_Python_Subprocess - Fatal编程技术网

Python Subprocess.Popen参数未传递给新进程

Python Subprocess.Popen参数未传递给新进程,python,subprocess,Python,Subprocess,musicdb[56]是“C:\\Users\\Andrew\\song.mp3” 因此,我尝试将一首歌传递到mplayer,如果我引用这首歌,它会起作用,如: player = subprocess.Popen(["mplayer", "C:\\Users\\Andrew\\song.mp3"], creationflags = subprocess.CREATE_NEW_CONSOLE) 但是 即使musicdb[56]与第一个示例中使用的字符串完全相同,也不起作用 有人能解释为什么吗?

musicdb[56]是“C:\\Users\\Andrew\\song.mp3”

因此,我尝试将一首歌传递到mplayer,如果我引用这首歌,它会起作用,如:

player = subprocess.Popen(["mplayer", "C:\\Users\\Andrew\\song.mp3"], creationflags = subprocess.CREATE_NEW_CONSOLE)
但是

即使musicdb[56]与第一个示例中使用的字符串完全相同,也不起作用

有人能解释为什么吗?
我在谷歌上找不到任何东西。

要调试此类问题,我使用以下方法:

cmd = ["mplayer", musicdb[56]]
print repr(cmd)
subprocess.Popen(cmd, ...)

使用
repr
,您可以看到隐藏在看似无辜的字符串中的所有奇怪的东西(例如,在末尾添加额外的新行字符)。

要调试此类问题,我使用以下方法:

cmd = ["mplayer", musicdb[56]]
print repr(cmd)
subprocess.Popen(cmd, ...)

使用
repr
,您可以看到隐藏在看似无辜的字符串中的所有奇怪的东西(例如,在末尾添加额外的新行字符)。

要调试此类问题,我使用以下方法:

cmd = ["mplayer", musicdb[56]]
print repr(cmd)
subprocess.Popen(cmd, ...)

使用
repr
,您可以看到隐藏在看似无辜的字符串中的所有奇怪的东西(例如,在末尾添加额外的新行字符)。

要调试此类问题,我使用以下方法:

cmd = ["mplayer", musicdb[56]]
print repr(cmd)
subprocess.Popen(cmd, ...)

使用
repr
,您可以看到隐藏在看似无辜的字符串中的所有奇怪的东西(例如,在末尾有额外的新行字符)。

您编写了
musicdb[56]=“C:\\Users\\Andrew\\song.mp3”
而不是
musicdb[56]=“C:\\Users\\Andrew\\song.mp3”
我只是指musicdb[56]就是那个字符串-它都是从txt文件读取的-很抱歉你写的混淆
musicdb[56]=“C:\\Users\\Andrew\\song.mp3”
而不是
musicdb[56]=“C:\\Users\\Andrew\\song.mp3”
我只是说musicdb[56]就是那个字符串-它都是从txt文件读取的-很抱歉你写的混淆
musicdb[56]=“C:\\Users\\Andrew\\song.mp3”
而不是
musicdb[56]=“C:\\Users\\Andrew\\song.mp3”
我只是说musicdb[56]就是那个字符串-它都是从txt文件读取的-很抱歉你写的混淆
musicdb[56]=“C:\\Users\\Andrew\\song.mp3”
而不是
musicdb[56]=“C:\\Users\\Andrew\\song.mp3”
我只是说musicdb[56]就是那个字符串-它都是从一个txt文件中读取的-很抱歉搞混了这就是它!字符串末尾的换行符。这正是它的含义!字符串末尾的换行符。这正是它的含义!字符串末尾的换行符。这正是它的含义!字符串末尾的换行符。