Joseph Farah
Joseph Farah

Reputation: 2534

Python doesn't think file exists when it does

I have this function in my code:

def send_info(self, bfile, output_file_name, tag):
    self.command = r"sshpass -p {3} scp -P 5622 {0} {1}@{2}:/home/blender/Documents/blade_queue/".format(str(current_render.blend), self.uname, self.host, self.password)
    print self.command
    self.response = subprocess.check_output(self.command)

Which prints out:

sshpass -p PASSWORD scp -P PORT /mnt/c/Users/Joseph\ Farah/Documents/python/cross_computer_rendering_gui/src/test.blend blender@IP /home/blender/Documents/blade_queue/

When I copy and paste this command into my shell, it works absolutely beautifully. However, trying to run this in Python results in:

OSError: [Errno 2] No such file or directory

On that line.

Any help would be appreciated! Thanks in advance.

Upvotes: 0

Views: 130

Answers (1)

Joseph Farah
Joseph Farah

Reputation: 2534

Figured it out. I needed to add shell=True to the command. Does anyone know if this will cause any security vulnerabilities?

Edited command:

self.response = subprocess.check_output(self.command, shell=True)

Upvotes: 1

Related Questions