Skip to content

Commit

Permalink
[Fix] Wrap log_path with Path (deepmodeling#4117)
Browse files Browse the repository at this point in the history
`FLAGS.log_path` need to be wrapped into `Path` type, or will raise
error when call `.parent`.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit


- **Improvements**
- Enhanced handling of log file paths for better compatibility and
functionality in file operations.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: HydrogenSulfate <490868991@qq.com>
  • Loading branch information
HydrogenSulfate authored and mtaillefumier committed Sep 18, 2024
1 parent f0ed0af commit bda4824
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion deepmd/pt/entrypoints/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,11 @@ def main(args: Optional[Union[List[str], argparse.Namespace]] = None):
else:
FLAGS = args

set_log_handles(FLAGS.log_level, FLAGS.log_path, mpi_log=None)
set_log_handles(
FLAGS.log_level,
Path(FLAGS.log_path) if FLAGS.log_path else None,
mpi_log=None,
)
log.debug("Log handles were successfully set")
log.info("DeePMD version: %s", __version__)

Expand Down

0 comments on commit bda4824

Please sign in to comment.