Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Save conversations check for parent directory #4218

Merged
merged 5 commits into from Dec 2, 2021

Conversation

mojtaba-komeili
Copy link
Contributor

Patch description
Saving the conversation log was crashing if the parent directory of the provided path to save the file didn't exist. This patch checks for the dir that is going to contain the output file. It creates the parent directories if they do not exist.

Testing steps
Had a script that crashed while trying to save the data. The problem was solved after adding this code. It created the parent directory and saved the data.

Comment on lines 281 to 286
parent_dir = os.path.dirname(datapath)
if os.path.exists(parent_dir) and os.path.isdir(parent_dir):
return
logging.info(f'Parent directory ({parent_dir}) did not exist and was created.')
os.makedirs(parent_dir)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs to be migrated to pathmanager, thx

@mojtaba-komeili
Copy link
Contributor Author

mojtaba-komeili commented Dec 1, 2021

@stephenroller switched to PathManager.

Also, what's up with jslint? It keeps breaking for any PR today.

Copy link
Contributor

@stephenroller stephenroller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm. Prolly don't need the log but it's fine too

Moya has a separate lint pr

@mojtaba-komeili mojtaba-komeili merged commit d9548b5 into main Dec 2, 2021
@mojtaba-komeili mojtaba-komeili deleted the save_conversations branch December 2, 2021 19:07
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants