Skip to content

Suggest to remove file if unsuccessful in extraction #4

@quektc

Description

@quektc

Personally encountered an issue whereby the CSV file (in my case) is saved even though there were unsuccessful extractions.
This led to a lot of confusion when comparing files. I suggest the author add the following changes:

Original:
@staticmethod
def write_string_to_file(content_string, file_path):
f = open(file_path, "w+");
f.write(content_string);
f.close();
return "";

New version:
@staticmethod
def write_string_to_file(content_string, file_path):
try:
f = open(file_path, "w+");
f.write(content_string);
f.close();
except:
os.remove(file_path)
return "";

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