Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

python

fabric

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:

[[email protected]] 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.

like image 822
danny Avatar asked Jun 14 '11 23:06

danny


1 Answers

I found this error message rather misleading. The message that is printed is:

Fatal error: put() encountered an exception while uploading 'local/path'

Underlying exception:
    No such file

Which leads you to think the problem is that somehow Python isn't seeing the file at local/path. I'm not certain this is never the case, but both in the case of the original question and in my case, the issue had nothing to do with that, and instead the issue was that the remote folder couldn't be found. Since this command won't automatically create any folders in the path that it doesn't find, it fails when it can't find any of the remote folders in the remote path.

In my particular case, the issue was that I provided a path that I intended to be interpreted as absolute on a remote Linux system, but I left off the initial /.

like image 196
ArtOfWarfare Avatar answered Sep 30 '22 18:09

ArtOfWarfare