You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I get the error :
csv_writer = csv.writer(output_csv_file, delimiter=col_separator, lineterminator=row_separator)
TypeError: argument 1 must have a "write" method
Problem
write_scene_list passes a string to csv.writer and not a writable open file.
edit1: readability
edit2: i should do something like :
with open("csvfile.csv", "w", newline="") as f:
write_scene_list(
f,
scene_list,
include_cut_list=True,
cut_list=None,
col_separator=',',
row_separator='\n'
)
Environment:
[PySceneDetect] PySceneDetect 0.6.7.1
System Info
OS Windows-10-10.0.19045-SP0
Python CPython 3.12.9
Architecture 64bit + WindowsPE
Packages
av Not Installed
click 8.1.8
cv2 4.11.0
imageio Not Installed
imageio_ffmpeg Not Installed
moviepy Not Installed
numpy 1.26.4
platformdirs 4.3.7
scenedetect 0.6.7.1
tqdm 4.67.1
I'll add a clarifying comment in v0.7.1 including the rationale behind this, but in your edited comment you got it. Files need to be used with a context manager to make sure they get closed correctly, so the correct invocation is:
Activity
frelevesque commentedon Oct 18, 2025
My point is I think it should do it inside the write_scene_list function.
Breakthrough commentedon Jul 5, 2026
I'll add a clarifying comment in v0.7.1 including the rationale behind this, but in your edited comment you got it. Files need to be used with a context manager to make sure they get closed correctly, so the correct invocation is:
Breakthrough commentedon Aug 17, 2026
You are correct that this should probably accept both - numpy, imageio, and pandas all allow this.
Where they differ is on the arg name itself, so we can leave that as-is. I'm a fan of numpy's definition as
file: file, str, or pathlib.Path.Accept a path or file handle in write_scene_list (Breakthrough#566)