| View previous topic :: View next topic |
| Author |
Message |
Devilion Voice

Joined: 04 May 2005 Posts: 7
|
Posted: Thu Oct 04, 2007 5:11 pm Post subject: Ignoring feedback on ftp-ing.. |
|
|
Hi, I've edited myself a little script that upload a file to another server of mine using ncftp (another linux ftp client, because I don't have access to the normal ftp)..
My problem is that, when the script is executed, I always get this error:
(22:52:59) (dless) [22:54] Tcl error [affv_dcctrig]: /home/albert/dless/index.html:
(22:52:59) (dless) .../dless/index.html: ETA: 0:00 15.44/ 15.44 kB 56.25 MB/s
(22:52:59) (dless) .../dless/index.html: ETA: 0:00 15.44/ 15.44 kB 531.45 kB/s
Whilst that is not an error, it is the response to the uploading commands of ncftp, so, it works, and it uploads the file, but the script breaks off right then and there, because of the error.
How do I tell the bot to ignore this text, and not see it as an error?
This is the code:
| Code: | proc affv_dcctrig {handle ipx arg} {
global affvpath affvconfig affvchan
global affv_localdir affv_useftp affv_url
putlog "affv: Please wait..."
exec $affvpath -co $affvconfig
foreach affvc [string tolower $affvchan] {
set affv_filename "$affvnew.html"
set affv_newurl "$affv_url/$affv_filename"
if {$affv_useftp == 1} {
set affv_localfile "$affv_localdir/$affv_filename"
affv_sendftp $affv_localfile
puthelp "PRIVMSG #channel : $affv_url"
return 0
}
puthelp "PRIVMSG #channel : $affv_url"
}
} |
which triggers:
| Code: | proc affv_sendftp { localfile } {
global pingcheck
global affv_url
set pipe [open "|ncftp -u username -p password ftp.omgno.com" w]
#puts $pipe "binary" -- not needed
puts $pipe "put -f $localfile"
#puts $pipe "quit" -- not needed
close $pipe
puthelp "PRIVMSG #channel : $affv_url"
return 0
} |
|
|
| Back to top |
|
 |
rosc2112 Revered One

Joined: 19 Feb 2006 Posts: 1454 Location: Northeast Pennsylvania
|
Posted: Thu Oct 04, 2007 10:56 pm Post subject: |
|
|
enclose it in a catch function:
http://www.tcl.tk/man/tcl8.4/TclCmd/catch.htm
Evaluate script and trap exceptional returns
eg:
catch {set pipe [open "|ncftp -u username -p password ftp.omgno.com" w]
puts $pipe "put -f $localfile"
close $pipe
puthelp "PRIVMSG #channel : $affv_url"} error
return 0
Something like that. |
|
| Back to top |
|
 |
Devilion Voice

Joined: 04 May 2005 Posts: 7
|
Posted: Fri Oct 05, 2007 4:55 am Post subject: |
|
|
Thank you!
I've been searching for a function like that, but I just couldn't find it.... but it works!
Thanks a lot  |
|
| Back to top |
|
 |
|