use csv reader for counting instead of 'wc -l'
This commit is contained in:
parent
a44ef2a370
commit
dab0de4448
1 changed files with 4 additions and 5 deletions
|
@ -197,14 +197,13 @@ async def main_with_ctx(ctx, wanted_date):
|
|||
|
||||
log.info("going to process posts")
|
||||
|
||||
line_count_str, _path = subprocess.check_output(
|
||||
["wc", "-l", output_uncompressed_paths["posts"]]
|
||||
).split()
|
||||
line_count = int(line_count_str)
|
||||
|
||||
with output_uncompressed_paths["posts"].open(
|
||||
mode="r", encoding="utf-8"
|
||||
) as posts_csv_fd:
|
||||
line_count = 0
|
||||
counter_reader = csv.reader(posts_csv_fd)
|
||||
for _row in counter_reader:
|
||||
line_count += 1
|
||||
line_count -= 1 # remove header
|
||||
|
||||
log.info("%d posts to import", line_count)
|
||||
|
|
Loading…
Reference in a new issue