pythonfabric

Fabric put command gives fatal error: 'No such file' exception


I'm using Fabric 1.01, and in my fabfile I'm using the put command. The line is:

put('file.tar.gz', '~/file.tar.gz')

The server is in the env.hosts list. file.tar.gz is in the same directory as the fabfile, and i'm running the code from this directory.

When I run the code, it gets up to the point where it is running this put command. Just before failing the output is:

[uname@site.com] put: file.tar.gz -> ~/file.tar.gz

Fatal error: put() encountered an exception while uploading 'file.tar.gz'

Underlying exception message:
    No such file

Anyone know where this is coming from? The file definitely exists on my local machine, and I've also tried the second put() argument as just '/server/path/to/' and I've tried using the absolute path of the file for the first put() argument, all to no avail.


Solution

  • Oops, I got lazy when anonymizing the question. My code contained a tilde:

    put('file.tar.gz', '~/file.tar.gz')
    

    Apparently Fabric did the tilde interpolation using the home directory of my local machine, not the server. After replacing the tilde with the explicit path on the server it works fine.