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

fix: ensure that the entire directory path is created; refactor: don't use same variable name in the parent loop; #294

Open
wants to merge 2 commits into
base: old_gpt_2_chinese_before_2021_4_22
Choose a base branch
from

Conversation

RealHurrison
Copy link

Using os.mkdir to create a directory can lead to an error if the parent directory does not exist. It's safer to use os.makedirs with the exist_ok=True parameter to ensure that the entire directory path is created if it does not exist.
The original line uses os.mkdir which can fail if the directory's parent does not exist. Changing it to os.makedirs and adding the exist_ok=True parameter ensures that the directory is created along with any necessary parent directories, preventing potential runtime errors.

Using os.mkdir to create a directory can lead to an error if the parent directory does not exist. It's safer to use os.makedirs with the exist_ok=True parameter to ensure that the entire directory path is created if it does not exist.
The original line uses os.mkdir which can fail if the directory's parent does not exist. Changing it to os.makedirs and adding the exist_ok=True parameter ensures that the directory is created along with any necessary parent directories, preventing potential runtime errors.
@lishangru
Copy link

lishangru commented Apr 25, 2024 via email

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

Successfully merging this pull request may close these issues.

2 participants