Skip to content

Commit d2a4304

Browse files
committed
fix: utf8 encoding check was still using NamedTemporaryFile technique
that was supplanted by temporary directory approach introduced in https://github.com/dathere/datapusher-plus/pull/117/files
1 parent cee3b0e commit d2a4304

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

datapusher/jobs.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -665,12 +665,13 @@ def _push_to_datastore(task_id, input, dry_run=False, temp_dir=None):
665665
"Normalizing/UTF-8 transcoding {} to CSV...".format(resource_format)
666666
)
667667

668-
qsv_input_utf_8_encoded_csv = tempfile.NamedTemporaryFile(suffix=".csv")
668+
qsv_input_utf_8_encoded_csv = os.path.join(temp_dir, 'qsv_input_utf_8_encoded.csv')
669+
669670
# using uchardet to determine encoding
670671
file_encoding = subprocess.run(
671672
[
672673
"uchardet",
673-
tmp.name
674+
tmp
674675
],
675676
check=True,
676677
capture_output=True,
@@ -691,9 +692,9 @@ def _push_to_datastore(task_id, input, dry_run=False, temp_dir=None):
691692
file_encoding.stdout,
692693
"-t",
693694
"UTF-8",
694-
tmp.name,
695+
tmp,
695696
"--output",
696-
qsv_input_utf_8_encoded_csv.name,
697+
qsv_input_utf_8_encoded_csv,
697698
],
698699
check=True,
699700
)
@@ -708,7 +709,7 @@ def _push_to_datastore(task_id, input, dry_run=False, temp_dir=None):
708709
[
709710
qsv_bin,
710711
"input",
711-
qsv_input_utf_8_encoded_csv.name,
712+
qsv_input_utf_8_encoded_csv,
712713
"--trim-headers",
713714
"--output",
714715
qsv_input_csv,

0 commit comments

Comments
 (0)