Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggest to remove file if unsuccessful in extraction #4

Open
quektc opened this issue Sep 14, 2023 · 0 comments
Open

Suggest to remove file if unsuccessful in extraction #4

quektc opened this issue Sep 14, 2023 · 0 comments

Comments

@quektc
Copy link

quektc commented Sep 14, 2023

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 "";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant