【发布时间】:2017-03-29 13:13:16
【问题描述】:
我正在将一个文件从 Django 网站上传到我的 WordPress。
from subprocess import check_call
try:
check_call(['scp', filename, upload_filename])
....
except (CalledProcessError, OSError):
report['error_messages'].append("4 %s" % exc_info()[1])
return report
这给出了错误:
命令'['scp', '/uploads/test-01.txt', 'mysite.com:/home/wp-content/uploads/test-01.txt']' 返回非零 退出状态 1
现在, 如果我从控制台手动操作:
scp /uploads/test-01.txt mysite.com:/home/wp-content/uploads/test-01.txt
它正在工作:
test-01.txt 100% 0 0.0KB/s 00:00
(这是一个空文件,所以 0 KB)
我不明白为什么 scp 从 Django 失败。错误不清楚。我能做什么?
【问题讨论】:
-
尝试在文件中放入一行文本,会发生同样的事情吗?
-
@postoronnim 你是什么意思?