Re: Why does my ftp script quit after couple of hours?
Awesome stuff, thank you so much for all the help. The Pcomp.lang.python is the most helpful list I have encountered so far :) -- http://mail.python.org/mailman/listinfo/python-list
Re: Why does my ftp script quit after couple of hours?
On Friday 14 August 2009 18:25:50 kk wrote: As far as robustness, I agree with your assestment. I guess my main confusion with my result is that the console window just disappears. I wonder if I can make the window stay even if it crashesor if there are connection issues? I will createa seperate log file to see if I can catch any issues in a log file. try opening python with the -i flag - then the console window hangs around after the script exits and you can examine variables and stuff. - Hendrik -- http://mail.python.org/mailman/listinfo/python-list
Why does my ftp script quit after couple of hours?
Hi This way the first time I did something with ftp stuff. I think that generally it works but it stops working(quits or disappears) after couple of hours of running. This was a personal test-trial script for my own needs which was to get my dynamic ip and broadcast to a client(I have a client script on another computer). I sure could use something like DynDns for the same purpose with easier management but I just wanted to give it a try to see if i could even make it work . Basically this script parses my ip from DynDns ip check page and uploads it to the given ftp site. It works fine initially, it does upload, it updates the Ip every hour but the problem is that after couple of hours the Python console window disappears, I assume it crashes. I know it does upload at least couple times(works for couple hours). it might be something to do with ftp connection. I will investigate that but I just wanted to see if I have any logic or some kind of contextual problem in the script. Here is the link to Pastie page http://pastie.org/584152 Thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: Why does my ftp script quit after couple of hours?
kk schrieb: Hi This way the first time I did something with ftp stuff. I think that generally it works but it stops working(quits or disappears) after couple of hours of running. This was a personal test-trial script for my own needs which was to get my dynamic ip and broadcast to a client(I have a client script on another computer). I sure could use something like DynDns for the same purpose with easier management but I just wanted to give it a try to see if i could even make it work . Basically this script parses my ip from DynDns ip check page and uploads it to the given ftp site. It works fine initially, it does upload, it updates the Ip every hour but the problem is that after couple of hours the Python console window disappears, I assume it crashes. I know it does upload at least couple times(works for couple hours). it might be something to do with ftp connection. I will investigate that but I just wanted to see if I have any logic or some kind of contextual problem in the script. Here is the link to Pastie page http://pastie.org/584152 The code isn't very robust if anything happens retrieving the IP-website - if for some reason the connection is broken, it won't catch any ensuing IO-exception. Also your way of extracing the IP is rather awkward, a simple re (often not the right tool, but here certainl yes) would help: m = re.search(r(([0-9]+\.){3}[0-9]+), body) m.group(1) '85.177.92.101' Diez -- http://mail.python.org/mailman/listinfo/python-list
Re: Why does my ftp script quit after couple of hours?
Hi Diez Thanks for your insight. The reason I chose the awkward method to parse the ip digits is that I was not familiar with the regex module and the Dyndns Ip page is pretty simple page. I guess it is time to learn more about the Re module. As far as robustness, I agree with your assestment. I guess my main confusion with my result is that the console window just disappears. I wonder if I can make the window stay even if it crashesor if there are connection issues? I will createa seperate log file to see if I can catch any issues in a log file. -- http://mail.python.org/mailman/listinfo/python-list
Re: Why does my ftp script quit after couple of hours?
On 14 Ago, 18:03, kk maymunbe...@gmail.com wrote: Hi This way the first time I did something with ftp stuff. I think that generally it works but it stops working(quits or disappears) after couple of hours of running. This was a personal test-trial script for my own needs which was to get my dynamic ip and broadcast to a client(I have a client script on another computer). I sure could use something like DynDns for the same purpose with easier management but I just wanted to give it a try to see if i could even make it work . Basically this script parses my ip from DynDns ip check page and uploads it to the given ftp site. It works fine initially, it does upload, it updates the Ip every hour but the problem is that after couple of hours the Python console window disappears, I assume it crashes. I know it does upload at least couple times(works for couple hours). it might be something to do with ftp connection. I will investigate that but I just wanted to see if I have any logic or some kind of contextual problem in the script. Here is the link to Pastie pagehttp://pastie.org/584152 Thanks Try catching the exception inside the main loop, to prevent your program to exit in case of failure: if __name__=='__main__': while True: try: writeExtFile(FILE_PATH,FILE_NAME) uploadFile (FTP_NAME,FTP_USER_NAME,FTP_PASSWD,FTP_FOLDER,FILE_NAME) time.sleep(TIME_DELAY) except: err, det, tb = sys.exc_info() print ERROR =, err, det # gives you a description of the occurred failure traceback.print_tb(tb) # this might be needed only for debug Ciao FB -- http://mail.python.org/mailman/listinfo/python-list
Re: Why does my ftp script quit after couple of hours?
kk schrieb: Hi Diez Thanks for your insight. The reason I chose the awkward method to parse the ip digits is that I was not familiar with the regex module and the Dyndns Ip page is pretty simple page. I guess it is time to learn more about the Re module. As far as robustness, I agree with your assestment. I guess my main confusion with my result is that the console window just disappears. I wonder if I can make the window stay even if it crashesor if there are connection issues? I will createa seperate log file to see if I can catch any issues in a log file. I'm not a Windows-user, but even there it should be possible to *first* open the console, and then start the script in it. That will keep it open you can see the stacktrace. Diez -- http://mail.python.org/mailman/listinfo/python-list