title: Run script with arguments via ssh with at command from python script
body: <p>I have a python program which needs to call a script on a remote system via ssh.  </p>
  
  <p>This ssh call needs to happen (once) at a specified date which can be done via the linux at command.</p>
  
  <p>I am able to call both of these external bash commands using either the <code>os</code> module or the <code>subprocess</code> module from my python program.  The issue comes when passing certain arguments to the remote script.</p>
  
  <p>In addition to being run remotely and at a later date, the (bash) script I wish to call requires several arguments to be passed to it, these arguments are python variables which I wish to pass on to the script.</p>
  
  <pre><code>user="user@remote"
  arg1="argument with spaces"
  arg2="two"
  cmd="ssh "+user+"' /home/user/path/script.sh "+arg1+" "+arg2+"'" 
  os.system(cmd)
  </code></pre>
  
  <p>One of these arguments is a string which contains spaces but would ideally be passed as a single argument; </p>
  
  <p>for example:</p>
  
  <p><code>./script.sh "Argument with Spaces"</code>
  where $1 is equal to <code>"Argument with Spaces"</code></p>
  
  <p>I have tried various combinations of escaping double and single quotes in both python and the string itself and the use of grave accents around the entire ssh command.  The most successful version calls the script with the arguments as desired, but ignores the at command and runs immediately. </p>
  
  <p>Is there a clean way within python to accomplish this?</p>