(send_data) Don't open an already open file
This commit is contained in:
10
send_data.py
10
send_data.py
@@ -238,11 +238,11 @@ def check_all_data_is_saved(data_file, quiet=False):
|
|||||||
print('Wait a second and check that all the data has been sent')
|
print('Wait a second and check that all the data has been sent')
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
with open(data_file.name, 'r') as file:
|
data_file.seek(0)
|
||||||
lines = file.readlines()
|
lines = data_file.readlines()
|
||||||
file_nb_line = len(lines) / 2
|
file_nb_line = int(len(lines) / 2)
|
||||||
extract = json.loads(lines[1])
|
extract = json.loads(lines[1])
|
||||||
data_type = extract['type']
|
data_type = extract['type']
|
||||||
|
|
||||||
if not quiet:
|
if not quiet:
|
||||||
print("\tFound: {} lines in '{}' file".format(file_nb_line, data_file.name))
|
print("\tFound: {} lines in '{}' file".format(file_nb_line, data_file.name))
|
||||||
|
|||||||
Reference in New Issue
Block a user