Okay, so I've been struggling with this one for awhile. I'm trying to create a python3 script that automatically uploads a file to a server. In the commandline, the following command works like a charm:
sftp -i key.pem -P 3912 admin@myServerIP:home/files/ <<< $"put test.txt"
But, when I try to run that command in my python script (either through os.system('command')
or subprocess.call('command')
) I keep getting the following error:
/bin/sh: 1: Syntax error: redirection unexpected
After doing some research, I believe I found that I need to run the command in /bin/bash, instead of the default dash, but I've tried everything, and connot for the life of me figure out how to do that! I hope this is a simple, stupid fix, so I can be on my way. Thanks!