Code Monkey home page Code Monkey logo

Comments (5)

remram44 avatar remram44 commented on July 23, 2024

What is wait()? Do you mean time.sleep() or equivalent?

This is weird because this lib is supposed to block until the transfer is finished 😮

from scp.py.

bott17 avatar bott17 commented on July 23, 2024

Sorry, time.sleep() its correct, not wait()

yeah that was my face when i see that :O
Maybe SO need some time to make a flush or something... I tests it on AWS-EC2

from scp.py.

remram44 avatar remram44 commented on July 23, 2024

This is surprising to me because the tej library I wrote uploads files and executes them immediately, and never ran into this issue. Are you sure scp has returned when you access the file? Are you using multiple threads in your client?

from scp.py.

bott17 avatar bott17 commented on July 23, 2024

I think so, only 1 thread and wait for scp completed to continue. I don´t have access to the code anymore, sorry :/

from scp.py.

remram44 avatar remram44 commented on July 23, 2024

I just tested this and could not reproduce:

from paramiko import SSHClient
from scp import SCPClient

# Connect via SSH
ssh = SSHClient()
ssh.load_system_host_keys()
ssh.connect('ec2-server')

# Open a shell
chan = ssh.get_transport().open_session()
chan.exec_command('/bin/sh')

# Put file
scp = SCPClient(ssh.get_transport())
scp.put('test.txt', 'test.txt')

# Test that the file exists
chan.send('exec cat test.txt 2>&1\n')
out = chan.recv(4096)
while out:
    print(repr(out))
    out = chan.recv(4096)
print(chan.recv_exit_status())

chan.close()
scp.close()
ssh.close()

I am going to go ahead and close this. Let me know if you run into the issue again, but really that would be a bug in the server, not this client library 🤔

from scp.py.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.