Re: ftplib throws: IndexError: tuple index out of range

2016-02-15 Thread Peter Otten
Antoon Pardon wrote: >> PS: How did you produce the overview over the local variables? That looks >> nice. > I started from this recipe: > http://code.activestate.com/recipes/52215-get-more-information-from-tracebacks/ > made it more to my liking and turned it into a module. So that instead of >

Re: ftplib throws: IndexError: tuple index out of range

2016-02-15 Thread Peter Otten
Antoon Pardon wrote: >> It looks like the actual error is socket.timeout which is probably raised >> from somewhere inside the stdlib without args. > > I think I know what is going on. I have my own timeout mechanism at work > here, that works with signals and alarm. When the SIGALRM fires I just

Re: ftplib throws: IndexError: tuple index out of range

2016-02-14 Thread Antoon Pardon
Op 14-02-16 om 14:40 schreef Peter Otten: > > PS: How did you produce the overview over the local variables? That looks > nice. > I started from this recipe: http://code.activestate.com/recipes/52215-get-more-information-from-tracebacks/ made it more to my liking and turned it into a module.

Re: ftplib throws: IndexError: tuple index out of range

2016-02-14 Thread Antoon Pardon
Op 14-02-16 om 14:40 schreef Peter Otten: > Antoon Pardon wrote: > >> I have written a small backup program, that uses ftplib to make >> remote backups. However recentely the program starts to regularly >> raise IndexErrors, as far as I can see the problem is in socket.py >> Can anyone shed some l

Re: ftplib throws: IndexError: tuple index out of range

2016-02-14 Thread Peter Otten
Antoon Pardon wrote: > I have written a small backup program, that uses ftplib to make > remote backups. However recentely the program starts to regularly > raise IndexErrors, as far as I can see the problem is in socket.py > Can anyone shed some light? > > This is the traceback: [...] > File

Re: ftplib throws: IndexError: tuple index out of range

2016-02-14 Thread Stephane Wirtel
Hi Antoon, EINTR, is an error when there is an emited signal to your process. http://man7.org/linux/man-pages/man2/read.2.html Look for EINTR in this page On 02/14, Antoon Pardon wrote: I have written a small backup program, that uses ftplib to make remote backups. However recentely the progr

Re: ftplib returns EOFError

2013-08-10 Thread Dorian MJ
print "\t\tUploading file %s..." % newname try: self.ftp.storbinary("STOR %s" % newname, open(file)) except EOFError: # yep?? self.ftp.connect(self.ftpServ) # reconnecting self.ftp.login(ftpUser, ftpPass) self.ftp.storbinary("STOR %s" % newname, open(file)) print "\t\tFile %s uploaded" % newname -

Re: ftplib - Did the whole file get sent?

2010-10-29 Thread Lawrence D'Oliveiro
In message <4cc5d9e9$0$1661$742ec...@news.sonic.net>, John Nagle wrote: > Look at sock_close in "socketmodule.c". Note that it ignores the > return status on close, always returns None, and never raises an > exception. As the Linux manual page for "close" says: > "Not checking the return val

Re: ftplib - Did the whole file get sent?

2010-10-25 Thread John Nagle
On 10/22/2010 10:03 PM, Sean DiZazzo wrote: Hi, I have some scripts that send files via ftplib to a client's ftp site. The scripts have generally worked great for a few years. Recently, the client complained that only part of an important file made it to their server. My boss got this complai

Re: ftplib - Did the whole file get sent?

2010-10-25 Thread sjm
On Oct 23, 2:03 am, Sean DiZazzo wrote: I follow every ftp put (STOR) with a dir command. Then if the recipient claims that they never got it (or did not get all of it), I have evidence that they did and that their byte count is the same as mine. This does not entirely guarantee that the ftp wa

Re: ftplib - Did the whole file get sent?

2010-10-25 Thread Brendan
On Oct 23, 1:03 pm, Sean DiZazzo wrote: > On Oct 22, 10:48 pm, Steven D'Aprano > cybersource.com.au> wrote: > > On Fri, 22 Oct 2010 22:03:38 -0700, Sean DiZazzo wrote: > > > How can I assure him (and the client) that the transfer completed > > > successfully like my log shows? > > > "It has worke

Re: ftplib - Did the whole file get sent?

2010-10-23 Thread Sean DiZazzo
On Oct 22, 10:48 pm, Steven D'Aprano wrote: > On Fri, 22 Oct 2010 22:03:38 -0700, Sean DiZazzo wrote: > > How can I assure him (and the client) that the transfer completed > > successfully like my log shows? > > "It has worked well for many years, there are no reported bugs in the ftp > code > [..

Re: ftplib - Did the whole file get sent?

2010-10-22 Thread Steven D'Aprano
On Fri, 22 Oct 2010 22:03:38 -0700, Sean DiZazzo wrote: > How can I assure him (and the client) that the transfer completed > successfully like my log shows? "It has worked well for many years, there are no reported bugs in the ftp code, and the logs show the file was transferred correctly. Unle

Re: ftplib limitations?

2010-08-28 Thread Lawrence D'Oliveiro
In message <4c78cc0d.8050...@sschwarzer.net>, Stefan Schwarzer wrote: > In message , Lawrence D'Oliveiro wrote: >> >> It might not be the fault of the FTP server. If you’re going through a >> router doing NAT, that could be where the timeout is happening. > > Good point, thanks! That may explain

Re: ftplib limitations?

2010-08-28 Thread Stefan Schwarzer
Hi Lawrence, On 2010-08-28 01:49, Lawrence D'Oliveiro wrote: >> Now it may be that the data connection, after having started >> the transfer, works as it should, but the control connection >> times out because the duration of the transfer is too long. > > It might not be the fault of the FTP serv

Re: ftplib limitations?

2010-08-27 Thread Lawrence D'Oliveiro
In message <4c74e604.6090...@sschwarzer.net>, Stefan Schwarzer wrote: > Now it may be that the data connection, after having started > the transfer, works as it should, but the control connection > times out because the duration of the transfer is too long. It might not be the fault of the FTP se

Re: ftplib limitations?

2010-08-25 Thread Stefan Schwarzer
Hi durumdara, On 2010-08-25 11:18, durumdara wrote: > On aug. 25, 08:07, Stefan Schwarzer wrote: >> >> The file is 2 GB in size and is fully transferred, without >> blocking or an error message. The status message from the >> server is '226-File successfully transferred\n226 31.760 >> seconds (me

Re: ftplib limitations?

2010-08-25 Thread Stefan Schwarzer
Hi durumdara, On 2010-08-25 09:43, durumdara wrote: >> I can imagine the error message (a full traceback if >> possible) would help to say a bit more about the cause of >> the problem and maybe what to do about it. > > This was: > > Filename: "Repositories 20100824_101805 (Teljes).zip" Size: 153

Re: ftplib limitations?

2010-08-25 Thread durumdara
Hi! On aug. 25, 08:07, Stefan Schwarzer wrote: > > The file is 2 GB in size and is fully transferred, without > blocking or an error message. The status message from the > server is '226-File successfully transferred\n226 31.760 > seconds (measured here), 64.48 Mbytes per second', so this > looks

Re: ftplib limitations?

2010-08-25 Thread durumdara
Hi! > > So if I understand correctly, the script works well on > smaller files but not on the large one? Yes. 500-800 MB is ok. > 1 GB is not ok. > > > It down all of the file (100%) but the next line never reached. > > _Which_ line is never reached? The `print` statement after > the `retrbinar

Re: ftplib limitations?

2010-08-24 Thread Stefan Schwarzer
Hi durumdara, On 2010-08-24 16:29, Stefan Schwarzer wrote: >> I experienced some problem. >> The server is Windows and FileZilla, the client is Win7 and Python2.6. >> When I got a file with size 1 303 318 662 byte, python is halt on >> "retrbinary" line everytime. > > So if I understand correctly

Re: ftplib limitations?

2010-08-24 Thread Stefan Schwarzer
Hi durumdara, On 2010-08-24 11:21, durumdara wrote: > def CallBack(Data): > d['size'] = d['size'] + len(Data) > d['buffer'].append(Data) > percent = (d['size'] / float(fsize)) * 100 > percentp10 = int(percent/10) > if percentp10 > d['lastpercentp10']: >

Re: ftplib timeout in Python 2.4

2009-12-18 Thread Nico Grubert
Try the timelimited function from this recipe Works perfect! Thanks a lot, Jean! -- http://mail.python.org/mailman/listinfo/python-list

Re: ftplib timeout in Python 2.4

2009-12-17 Thread r0g
Nico Grubert wrote: >> I don't know of one so you may need a workaround. What platforms do you >> need to support? > > Suse Linux Enterprise 10, 64 Bit with Python 2.4.4. > I need the Python 2.4.4 for a running application Server (Zope). OK, then one approach would be to use signals.alarm(timeo

Re: ftplib timeout in Python 2.4

2009-12-17 Thread Nico Grubert
I don't know of one so you may need a workaround. What platforms do you > need to support? Suse Linux Enterprise 10, 64 Bit with Python 2.4.4. I need the Python 2.4.4 for a running application Server (Zope). -- http://mail.python.org/mailman/listinfo/python-list

Re: ftplib timeout in Python 2.4

2009-12-17 Thread r0g
Nico Grubert wrote: > Hi there, > > The ftplib has a timeout parameter in Python 2.6 and above. > Is there a way to set a timeout in Python 2.4? > > Regards > Nico I don't know of one so you may need a workaround. What platforms do you need to support? Roger. -- http://mail.python.org/mailman

Re: ftplib retrlines timeout

2009-12-16 Thread BJ Swope
If it works like I've seen other python based network apps that have app timeouts, and Brandon's post seemed to indicate that his timed out during the readline portion of the FTP transfer. Auburn fans are like slinkys... not really good for anything but they still bring a smile to your face

Re: ftplib retrlines timeout

2009-12-16 Thread Jennifer
So you mean ftplib.FTP('.xxx.com',username,password,timeout) will timeout the retrlines as well, correct? Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: ftplib retrlines timeout

2009-12-16 Thread BJ Swope
I've had experiences with some python mail servers that time out connections if data from the socket is not sent to the application within the timeout parameter. I have seen a python app on FreeBSD that would timeout a connection after 600 seconds if freebsd did not receive at least 32 kb of data

Re: ftplib retrlines timeout

2009-12-16 Thread Brendan
On Dec 15, 6:17 pm, Jennifer wrote: > I am writing a program that has a requirement for  a timeout of > retrlines after the connection established. I just wonder if timeout > of ftplib.FTP('.xxx.com',username,password,timeout) will work for > retrlines method after the connection established.

Re: ftplib connection fails with multiple nics

2009-10-20 Thread Sean DiZazzo
On Oct 19, 10:23 pm, Tim Roberts wrote: > Sean DiZazzo wrote: > > >I'm trying to connect to an ftp site from a windows machine with two > >nics going to two different networks, but I keep getting the below > >exception: > > >Traceback (most recent call last): > >  File "ftp.pyo", line 70, in conn

Re: ftplib connection fails with multiple nics

2009-10-20 Thread Sean DiZazzo
On Oct 19, 10:23 pm, Tim Roberts wrote: > Sean DiZazzo wrote: > > >I'm trying to connect to an ftp site from a windows machine with two > >nics going to two different networks, but I keep getting the below > >exception: > > >Traceback (most recent call last): > >  File "ftp.pyo", line 70, in conn

Re: ftplib connection fails with multiple nics

2009-10-19 Thread Tim Roberts
Sean DiZazzo wrote: > >I'm trying to connect to an ftp site from a windows machine with two >nics going to two different networks, but I keep getting the below >exception: > >Traceback (most recent call last): > File "ftp.pyo", line 70, in connect > File "ftp.pyo", line 17, in __init__ > File "

Re: ftplib connection fails with multiple nics

2009-10-19 Thread Shantanu Joshi
Sean DiZazzo writes: > On Oct 16, 4:51 pm, Sean DiZazzo wrote: >> Hi all, >> >> I'm trying to connect to an ftp site from a windows machine with two >> nics going to two different networks, but I keep getting the below >> exception: >> >> Traceback (most recent call last): >>   File "ftp.pyo", l

Re: ftplib connection fails with multiple nics

2009-10-17 Thread Sean DiZazzo
On Oct 16, 4:51 pm, Sean DiZazzo wrote: > Hi all, > > I'm trying to connect to an ftp site from a windows machine with two > nics going to two different networks, but I keep getting the below > exception: > > Traceback (most recent call last): >   File "ftp.pyo", line 70, in connect >   File "ftp.

Re: ftplib - 226 message not received

2009-01-08 Thread Brendan
Okay, found it on my own. ftp.voidresp() is what is needed, and it does _not_ seem to be in the Python documentation for ftplib. On Jan 8, 1:58 pm, Brendan wrote: > I am trying to download a file within a very large zipfile. I need two > partial downloads of the zipfile. The first to get the file

Re: ftplib returns EOFError

2008-05-19 Thread Francesco Bochicchio
On Mon, 19 May 2008 13:27:23 +0100, Jon Bowlas wrote: > Hi All, > > I've written a little method to connect to an ftpserver which works well, > however when I send a file using this ftp connection oddly I _sometimes_ get > returned an EOFError from ftplib.getline even though my file is actually >

Re: ftplib question (cannot open data connection)

2008-01-13 Thread Laszlo Nagy
> BUT: active FTP does not just send the data to the port that was in > the random port that was sent to the server... it addresses to the port > you sent, but it sends its data response FROM port 20. This means the > response looks like a totally unsolicited connection attempt from the > ou

Re: ftplib error- Large file

2007-06-08 Thread Facundo Batista
[EMAIL PROTECTED] wrote: > Ok. I guess that makes sense. But what about the other > questions...mainly: Why would it throw an exception even though the > file was properly transferred? Je, well, I answered the one I knew about, :) Regarding the error... es hard to say. What happens if you tr

Re: ftplib error- Large file

2007-06-07 Thread half . italian
On Jun 7, 8:54 am, Facundo Batista <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > Why would storbinary throw an exception even when the file transfer > > was successful? Why would the exception not be thrown until after the > > file was sent? Shouldn't ftplib return something like (104

Re: ftplib error- Large file

2007-06-07 Thread Facundo Batista
[EMAIL PROTECTED] wrote: > Why would storbinary throw an exception even when the file transfer > was successful? Why would the exception not be thrown until after the > file was sent? Shouldn't ftplib return something like (104, > "Connection reset by peer") instead of throwing an error? Is my

Re: ftplib error- Large file

2007-06-07 Thread half . italian
On Jun 6, 11:21 pm, "Hendrik van Rooyen" <[EMAIL PROTECTED]> wrote: > <[EMAIL PROTECTED]> wrote: > > Hi all, > > > I'm using ftplib to transfer large files to remote sites. The process > > seems to work perfectly with small files, but when the file gets to > > large ~20GB I begin getting errors t

Re: ftplib error- Large file

2007-06-06 Thread Hendrik van Rooyen
<[EMAIL PROTECTED]> wrote: > Hi all, > > I'm using ftplib to transfer large files to remote sites. The process > seems to work perfectly with small files, but when the file gets to > large ~20GB I begin getting errors that sometimes seem to be non- > fatal, and other times the transfer does not

Re: ftplib error- Large file

2007-06-06 Thread Gabriel Genellina
En Wed, 06 Jun 2007 13:39:57 -0300, <[EMAIL PROTECTED]> escribió: > I'm using ftplib to transfer large files to remote sites. The process > seems to work perfectly with small files, but when the file gets to > large ~20GB I begin getting errors that sometimes seem to be non- > fatal, and other ti

Re: ftplib acting weird

2007-05-07 Thread Carlos Hanson
On May 4, 3:43 am, Merrigan <[EMAIL PROTECTED]> wrote: > Hi All, > > I have written a little script to upload some files to an ftp folder. > The problem is as follows : > > I wrote the script on my windows laptop, and I want to run it from > mylinux server. Everything worked fine so I uploaded it t

Re: ftplib and retrbinary or retrlines (losing newline characters in my log files)

2007-01-28 Thread Gabriel Genellina
At Friday 26/1/2007 09:47, aus stuff wrote: Hi, im not sure if this is how i reply to the mail-list, excuse me if incorrect. Forwarding now to the list. Gabriels' solution works fine > ftp.retrlines('RETR ' + fl, lambda line:fileObj.write('%s\n' % line)) But lambda's confuse me (newbie he

Re: ftplib and retrbinary or retrlines (losing newline characters in my log files)

2007-01-24 Thread Gabriel Genellina
At Thursday 25/1/2007 03:05, aus stuff wrote: Hi am successfully downloading my text files and writing them to local files with either ftp.retrlines('RETR ' + fl, fileObj.write)" ftp.retrbinary('RETR ' + fl, fileObj.write) However all

Re: ftplib question

2006-04-07 Thread RunLevelZero
Well I am not too familiar with ftplib but I have done some minimal work. Example: try: server=FTP() server.connect('ftp.mcafee.com', 21) except: print "Could not connect to server" raw_input("Hit Enter to quit:") sys.exit(0) login = server.login('anonymous', '[EMAIL PROTEC

Re: FTPlib

2006-02-13 Thread Peter A.Schott
Shouldn't that be: srcFtp.retrbinary('get ' + file[2:]) or some similar variation? You're also missing a block telling this where to write the local file. LocalFile = file.open(file[2:], "wb") LocalFile.write(srcFtp.retrbinary('get ' + file[2:]) ) (or something similar) -Pete "Harlin Seritt"

Re: FTPlib

2006-02-13 Thread Fredrik Lundh
Harlin Seritt wrote: > Using ftplib from Python I am trying to get all files in a particular > directory using ftplib and then send those same files to another ftp > server. I have tried using commands like 'get *' and 'mget *' with no > success. > > I am using the following: > > srcFtp = FTP(srcH

Re: ftplib question - ftp.dir() returns something and ftp.nlst() does not

2005-11-25 Thread Nico Grubert
> it's not obvious how Python could translate '' to anything other > than an empty list, so it sure looks like a server issue. > (or is a problem with running in passive mode? can you test with- > out using passive mode on the same server?) I thought using "ftp.set_pasv(0)" sets active mode

Re: ftplib question - ftp.dir() returns something and ftp.nlst() does not

2005-11-25 Thread Fredrik Lundh
Nico Grubert wrote: > *cmd* 'NLST' > *put* 'NLST\r\n' > *get* '150 About to open data connection.\r\n' > *resp* '150 About to open data connection.' > *retr* '' > *get* '226 Transfer complete.\r\n' > *resp* '226 Transfer complete.' > [] > >>> it's not obvious how Python could translate '' to any

Re: ftplib question - ftp.dir() returns something and ftp.nlst() does not

2005-11-25 Thread Nico Grubert
> add > > ftp.set_debuglevel(3) > > so you can see what the goes on the wire (without that information, it's hard > to tell if it's a bug in the library or a glitch in your server). > > Hello Fredrik , thank you for your reply. I did a "ftp.set_debuglevel(3)" and ftp.nlst() now prints:

Re: ftplib question - ftp.dir() returns something and ftp.nlst() does not

2005-11-24 Thread Fredrik Lundh
Nico Grubert wrote: > I am using the ftplib library to connect to a ftp server. > After I got connected, I can see a list of file in the current directory > using ftp.dir() or ftp.retrlines('LIST'). But using ftp.nlst() returns > an empty list which seems somehow strange to me. Here is, what I did

Re: ftplib fails when directory name contains spaces

2005-05-27 Thread Manu
Oops..It was my mistake :(. Directory name with spaces work by default. -- http://mail.python.org/mailman/listinfo/python-list

Re: FTPLIB & FTPS or SFTP?

2005-01-20 Thread Peter A.Schott
Can't seem to hit the site right now. I'll have to try back later. From what I can tell, there aren't any mirrors set up, either. Two quick recommendations is promising, though. Thanks for the recommendations. -Pete "Roger Binns" <[EMAIL PROTECTED]> wrote: > > "Peter A. Schott" <[EMAIL PROT

Re: FTPLIB & FTPS or SFTP?

2005-01-19 Thread Roger Binns
"Peter A. Schott" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > have a handful of partners who use FTPS or SFTP and I need to pull/push files > to/from them. For SFTP, run don't walk, over to http://www.lag.net/paramiko/ Paramiko is a pure Python(*) implementation of SSH and all

Re: FTPLIB & FTPS or SFTP?

2005-01-19 Thread srijit
To the best of my knowledge ftplib does not support SFTP or FTPS. I hope Paramiko (http://www.lag.net/paramiko/) serves your purpose. Paramiko supports POSIX, Windows and MacOSX Regards, /Srijit Peter A. Schott wrote: > Does the ftplib support SFTP or FTPS? Is that part of a different module? W

Re: ftplib strange behaviour

2005-01-18 Thread siggy2
Kartic wrote: > I have used ftplib but never for such a huge file (assuming your > problem is related to the size of the file). we're doing that since python 2.2 from different site to different hosts where our script was installed... needless to say all the (few) problems we had came from the serv

Re: FTPLIB - retry files?

2005-01-17 Thread Mark McEahern
Peter A.Schott wrote: Is there any way to retry sending files with some delay up to a set number on failure? Sometimes we encounter a locked file on our server or the destination server and we want to retry that file in X seconds. In general, what's wrong with this: import time retryCount = 1

Re: ftplib with unknown file names

2005-01-10 Thread rbt
Jeremy Jones wrote: rbt wrote: How can I use ftplib to retrieve files when I do not know their names? I can do this to get a listing of the directory's contents: ftp_server.retrlines('LIST') The output from this goes to the console and I can't figure out how to turn that into something I can use

Re: ftplib with unknown file names

2005-01-10 Thread Jeremy Jones
rbt wrote: How can I use ftplib to retrieve files when I do not know their names? I can do this to get a listing of the directory's contents: ftp_server.retrlines('LIST') The output from this goes to the console and I can't figure out how to turn that into something I can use to actually get the

Re: ftplib strange behaviour

2004-12-31 Thread Kartic
PiErre, I have used ftplib but never for such a huge file (assuming your problem is related to the size of the file). Have you tried downloading the file using another ftp client? Does that download succeed? The reason I ask is because I have attempted downloads from servers that terminate the co