简体   繁体   English

Python-Spur ssh命令弄乱了文件路径

[英]Python - spur ssh command messing up file paths

I am using spur in python 2.7, ssh'ing into a linux box, but for some reason it is messing with my file paths. 我在python 2.7中使用spur,将ssh'插入linux盒,但是由于某种原因,它弄乱了我的文件路径。 here is the command: 这是命令:

import spur
outFile = "'%s'" % outFile
shell = spur.SshShell(hostname=self.run_params["host"], username=self.run_params["username"], password=self.run_params["password"], missing_host_key=spur.ssh.MissingHostKey.accept)
print outFile
result = shell.run(["ln", "-sf", movFile, outFile])

This is the output of the print outFile : 这是print outFile的输出:

'/RAIDS/RAID_1/Unmanaged/platform-deliveries-103_1/Content/_GOOGLE/Ninl/NBV_1234-source.mov'

But when I run the command I get this error with the outFile: 但是当我运行命令时,出现outFile这个错误:

RunProcessError: return code: 1
output: b''
stderr output: b"ln: creating symbolic link `\\'/RAIDS/RAID_1/Unmanaged/platform-deliveries-103_1/Content/_GOOGLE/Ninl/NBV_1234-source.mov\\'': No such file or directory\n"

What is adding the \\\\ at the beginning and at the end of my link? 在链接的开头和结尾添加\\\\是什么?

I found the answer. 我找到了答案。 I was using outFile = "'%s'" % outFile to account for spaces in the file path, with spur doesn't need. 我正在使用outFile =“'%s'”%outFile来解决文件路径中的空格,不需要杂散。 Removing this fixed the issue. 删除此问题已解决。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM