Skip to content

write_scene_list(csv_file) #523

@frelevesque

Description

@frelevesque

Description:

Hello,

Thank you for that amazing package.

When using the line :

write_scene_list(
        "csvfile.csv",
        scene_list, 
        include_cut_list=True, 
        cut_list=None, 
        col_separator=',', 
        row_separator='\n'
        )

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.

My fix for now is :

write_scene_list(
        open("csvfile.csv", "w", newline=""),
        scene_list, 
        include_cut_list=True, 
        cut_list=None, 
        col_separator=',', 
        row_separator='\n'
        )

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

Tools

ffmpeg 8.0-full_build-www.gyan.dev
mkvmerge v95.0 ('Goodbye Stranger') 64-bit

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions