Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In fabric 2.0.1 connection.get() fails in windows with PermissionError: [Errno 13] Permission denied: when trying to copy to a custom local path. #1782

Closed
nagavnaga opened this issue May 29, 2018 · 2 comments

Comments

@nagavnaga
Copy link

nagavnaga commented May 29, 2018

with Connection(host) as cxn: cxn.run(cmd) local_path = r'C:\Program Files\JetBrains\my codes\fabric framework\fabric2.0\SG_info' cxn.get(filename, local_path)

Same is working fine when i leave the local path to default
or
Set the local path by changing the cwd() like below and leave the local path to default.

os.chdir(r'C:\Program Files\JetBrains\my codes\fabric framework\fabric2.0\SG_info')

Full trace is below
"C:/Program Files/JetBrains/my codes/fabric framework/fabric2.0/just1.py"
Traceback (most recent call last):
File "C:/Program Files/JetBrains/my codes/fabric framework/fabric2.0/just1.py", line 14, in
cxn.get('sym.txt', local_path)
File "C:\Users\venkan5\AppData\Local\Programs\Python\Python36-32\lib\site-packages\fabric\connection.py", line 628, in get
return Transfer(self).get(*args, **kwargs)
File "C:\Users\venkan5\AppData\Local\Programs\Python\Python36-32\lib\site-packages\fabric\transfer.py", line 112, in get
sftp.get(remotepath=remote, localpath=local)
File "C:\Users\venkan5\AppData\Local\Programs\Python\Python36-32\lib\site-packages\paramiko\sftp_client.py", line 769, in get
with open(localpath, 'wb') as fl:
PermissionError: [Errno 13] Permission denied: 'C:\Program Files\JetBrains\my codes'

@bitprophet
Copy link
Member

Suspect this is the same bug as #1749, please follow there and give it another shot once that's fixed and out. Thanks!

@zachbryant
Copy link

I've been getting a similar issue with 2.2.1 too. As it turns out, the sftp server and ssh server of the same machine don't always display the same directory structures. I was getting permission denied or file not found because I was stuck in a different root folder. Unfortunately I found that this is not always the case, as one of my servers does have the same sftp and ssh directory structures.

I found that working directly with connection.sftp(), connection.command_cwds, and opening local files as bytes solves my problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants