Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #84476

pysftp connection not sending files, hanging on 'put'

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!newsreader4.netcologne.de!news.netcologne.de!takemy.news.telefonica.de!telefonica.de!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <droolz202@googlemail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.042
X-Spam-Evidence '*H*': 0.92; '*S*': 0.00; 'subject:not': 0.03; 'output': 0.05; 'root': 0.05; 'subject:files': 0.09; '-&gt;': 0.16; 'fine).': 0.16; 'ftp,': 0.16; 'opened.': 0.16; 'skip:3 30': 0.16; 'skip:p 90': 0.16; 'subject:sending': 0.16; 'trying': 0.19; 'finished': 0.19; 'seems': 0.21; 'putting': 0.22; 'bytes': 0.24; 'logging': 0.26; 'code:': 0.26; 'skip:p 30': 0.29; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; "skip:' 10": 0.31; '8bit%:2': 0.31; 'fine,': 0.31; 'file': 0.32; 'connection': 0.35; 'skip:s 30': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'version': 0.36; 'in:': 0.36; 'doing': 0.36; 'skip:o 20': 0.38; 'server': 0.38; 'from:addr:googlemail.com': 0.38; 'to:addr:python-list': 0.38; 'files': 0.38; 'issue': 0.38; 'list,': 0.38; 'channel': 0.39; 'to:addr:python.org': 0.39; 'skip:p 20': 0.39; 'skip:u 10': 0.60; 'eventually': 0.60; 'skip:2 20': 0.60; 'skip:o 30': 0.61; 'here:': 0.62; 'times': 0.62; 'skip:n 10': 0.64; 'believe': 0.68; 'results': 0.69; 'url:info': 0.73; 'url:cd': 0.84; 'url:log': 0.84; 'url:self': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=HeCp5v6rgzeVHMn5xYqs/QG+YDy0k61ZhHK/BCleLPs=; b=fkyZFO3rthOG5S153pZrtd5yDY89Op/w+1amu/j55qAn06gE5+pgtDEjeZkF/5ECNT qgiTOZT1Ui3Hc03w0eUV/0V8KocQJXymNo43Y916ey9Q3bXDlrQ3nQ7aadYCKzY9UEsK tcqMVEcAO8xTO8OaRA/98SFlh9V54CxBcZ6i8LRQU2Ahx+M/x/mzdClVMpORLhRljFzh C+3vjr92bJUG1kDzwoqnGfb796AdkDRI/7SfArsGBh/MnCD/eirPcr9P5CHu6F5r9Wn2 yEmFGCeSOXcOpykKHok37sdpnwVvONH1vwQMvf7xWWX7duJthO0cS/3HL5sWyz9RUUCL g3Hg==
MIME-Version 1.0
X-Received by 10.112.26.135 with SMTP id l7mr12760186lbg.56.1422117143794; Sat, 24 Jan 2015 08:32:23 -0800 (PST)
Date Sat, 24 Jan 2015 16:32:23 +0000
Subject pysftp connection not sending files, hanging on 'put'
From Jules Stevenson <droolz202@googlemail.com>
To python-list@python.org
Content-Type multipart/alternative; boundary=001a113365662f5a84050d687331
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.18089.1422117151.18130.python-list@python.org> (permalink)
Lines 162
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1422117151 news.xs4all.nl 2931 [2001:888:2000:d::a6]:50900
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:84476

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

Hi List,

I'm trying to send some files via pysftp, authentication seems fine, but
actually putting the file results in it hanging, doing nothing. The files
are small (<200kb) so I don't believe it's an upload issue (internet access
is fine). Eventually the connection times out.

Code:

if os.listdir(ftp_path):# only do if files are there
with pysftp.Connection(FTP_SERVER,

port=2222

username=FTP_USER,

private_key=FTP_SSH_PRIVATE_KEY_PATH

) as sftp:

with sftp.cd(FTP_REMOTE_FOLDER):

for f in os.listdir(ftp_path):

if os.path.isfile(os.path.join(ftp_path,f)) :

# upload image to server

self.log.info("HB FTP, Start upload: "+f)

print(ftp_path+"\\"+f)

sftp.put(os.path.join(ftp_path,f))

self.log.info("HB FTP, Finished Upload: "+f)


Logging output here:

FSW_COMMS paramiko.transport 01/24/2015 04:23:58 PM: INFO: Authentication
(publickey) successful!
FSW_COMMS paramiko.transport 01/24/2015 04:23:58 PM: DEBUG: [chan 1] Max
packet in: 32768 bytes
FSW_COMMS paramiko.transport 01/24/2015 04:23:58 PM: DEBUG: [chan 1] Max
packet out: 0 bytes
FSW_COMMS paramiko.transport 01/24/2015 04:23:58 PM: DEBUG: Secsh channel 1
opened.
FSW_COMMS paramiko.transport 01/24/2015 04:23:58 PM: DEBUG: [chan 1] Sesch
channel 1 request ok
FSW_COMMS paramiko.transport.sftp 01/24/2015 04:23:58 PM: INFO: [chan 1]
Opened sftp connection (server version 3)
FSW_COMMS paramiko.transport.sftp 01/24/2015 04:23:58 PM: DEBUG: [chan 1]
normalize('.')
FSW_COMMS paramiko.transport.sftp 01/24/2015 04:23:58 PM: DEBUG: [chan 1]
stat('files')
FSW_COMMS paramiko.transport.sftp 01/24/2015 04:23:58 PM: DEBUG: [chan 1]
normalize('files')
FSW_COMMS root 01/24/2015 04:23:58 PM: INFO: HB FTP, Start upload:
2015-01-17-19-37-07.jpg
D:\FSW\ftp\2015-01-17-19-37-07.jpg
FSW_COMMS paramiko.transport.sftp 01/24/2015 04:23:58 PM: DEBUG: [chan 1]
open('/files/2015-01-17-19-37-07.jpg', 'wb')
FSW_COMMS paramiko.transport.sftp 01/24/2015 04:23:58 PM: DEBUG: [chan 1]
open('/files/2015-01-17-19-37-07.jpg', 'wb') ->
34613039393262343666383036653839

Any help much appreciated,

Jules

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

pysftp connection not sending files, hanging on 'put' Jules Stevenson <droolz202@googlemail.com> - 2015-01-24 16:32 +0000

csiph-web