Python 子进程调用复制文件时出错。没有文件,失败,但返回 1。为什么?

Emm*_*dev 5 python subprocess python-3.x python-3.6

import subprocess
import os

#files
src_file = '/../copy_me_test.txt'
destination_file = 'paste_here.txt'

#make copy of file
shell_command = 'cp "%s" "%s"' % (src_file, destination_file)
successful = subprocess.call(shell_command, shell = True)
print(successful)
Run Code Online (Sandbox Code Playgroud)

所以我将文件从一个目录复制到另一个目录。当我运行 subprocess.call() 方法时,它返回 1。除了没有任何反应,我在终端上收到以下消息。

cp: /Users/my_name/Desktop/python/copy_files/copy_me_test.txt: No such file or directory
1
Run Code Online (Sandbox Code Playgroud)

这里发生了什么?因为它无法复制文件,所以不应该返回 0 吗?我已经做了解决办法,但我想知道是否有人知道为什么会发生这种情况?任何信息或链接将不胜感激。

Dam*_*ero 2

根据这里的文档https://docs.python.org/2/library/subprocess.html失败时它将返回 1,还要检查如果使用属性 shell=True 是否有警告