tools/mpremote: Fix UnboundLocalError in Transport.fs_writefile().
The variable `written` was being used before it was defined in the `fs_writefile()` method of the Transport class. This was causing an `UnboundLocalError` to be raised when the `progress_callback` was not provided. Fixes issue #16084. Signed-off-by: Glenn Moloney <glenn.moloney@gmail.com>
This commit is contained in:
parent
f212bbe837
commit
5c7ac55232
@ -151,9 +151,9 @@ class Transport:
|
||||
while data:
|
||||
chunk = data[:chunk_size]
|
||||
self.exec("w(" + repr(chunk) + ")")
|
||||
written += len(chunk)
|
||||
data = data[len(chunk) :]
|
||||
if progress_callback:
|
||||
written += len(chunk)
|
||||
progress_callback(written, src_size)
|
||||
self.exec("f.close()")
|
||||
except TransportExecError as e:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user