This patch fixes the keyError while printing transfer progress.
---
test/ftp-client | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/test/ftp-client b/test/ftp-client
index 78c32b3..4540602 100755
--- a/test/ftp-client
+++ b/test/ftp-client
@@ -77,16 +77,18 @@ class FtpClient:
if path != self.transfer_path:
return
- if properties['Status'] == 'complete' or \
- properties['Status'] == 'error':
+ if "Status" in properties and \
+ (properties['Status'] == 'complete' or \
+ properties['Status'] == 'error'):
if self.verbose:
print("Transfer %s" % properties['Status'])
mainloop.quit()
return
- if properties["Transferred"] == None:
+ if "Transferred" not in properties:
return
+ value = properties["Transferred"]
speed = (value - self.transferred) / 1000
print("Transfer progress %d/%d at %d kBps" % (value,
self.transfer_size,
--
1.9.1
Hi Gowtham,
On Wed, Dec 2, 2015 at 4:25 PM, Gowtham Anandha Babu
<[email protected]> wrote:
> This patch fixes the keyError while printing transfer progress.
> ---
> test/ftp-client | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/test/ftp-client b/test/ftp-client
> index 78c32b3..4540602 100755
> --- a/test/ftp-client
> +++ b/test/ftp-client
> @@ -77,16 +77,18 @@ class FtpClient:
> if path != self.transfer_path:
> return
>
> - if properties['Status'] == 'complete' or \
> - properties['Status'] == 'error':
> + if "Status" in properties and \
> + (properties['Status'] == 'complete' or \
> + properties['Status'] == 'error'):
> if self.verbose:
> print("Transfer %s" % properties['Status'])
> mainloop.quit()
> return
>
> - if properties["Transferred"] == None:
> + if "Transferred" not in properties:
> return
>
> + value = properties["Transferred"]
> speed = (value - self.transferred) / 1000
> print("Transfer progress %d/%d at %d kBps" % (value,
> self.transfer_size,
> --
> 1.9.1
Applied, thanks.
--
Luiz Augusto von Dentz