Skip to content

Use shutil.copy instead of os.system('cp ...') for CV output files#51

Open
rayair250-droid wants to merge 1 commit into
dralgroup:mainfrom
rayair250-droid:fix/shutil-copy-in-mltasks
Open

Use shutil.copy instead of os.system('cp ...') for CV output files#51
rayair250-droid wants to merge 1 commit into
dralgroup:mainfrom
rayair250-droid:fix/shutil-copy-in-mltasks

Conversation

@rayair250-droid

Copy link
Copy Markdown

The train/subtrain/validate/test output files were copied with os.system and an f-string-interpolated path:

os.system(f"cp {tmpdirname}/itrain.dat {iTrainOut}")

This breaks when the output path (iTrainOut, …) contains spaces or shell metacharacters, and is Unix-only. Replaced the four copies with shutil.copy + os.path.join (shutil is already imported), so they are shell-free, robust to special characters, and portable. Behavior is otherwise unchanged.

…idate output

The three output copies used os.system with f-string-interpolated paths, which breaks when the output path contains spaces or shell metacharacters, and is Unix-only. Replace with shutil.copy + os.path.join (shutil is already imported).
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.

1 participant