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

Error in ut init #57

Open
sindrijonsson opened this issue Sep 26, 2022 · 1 comment
Open

Error in ut init #57

sindrijonsson opened this issue Sep 26, 2022 · 1 comment

Comments

@sindrijonsson
Copy link

Hi,
I ran into an error when running through the demo in the README

ut init --name demo --model usleep_demo
Traceback (most recent call last):
File "\Anaconda3\envs\u-sleep\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "\Anaconda3\envs\u-sleep\lib\runpy.py", line 86, in run_code
exec(code, run_globals)
File "\Anaconda3\envs\u-sleep\Scripts\ut.exe_main
.py", line 7, in
File "\Anaconda3\envs\u-sleep\lib\site-packages\utime\bin\ut.py", line 103, in entry_func
mod.entry_func(script_args + help_agrs)
File "\Anaconda3\envs\u-sleep\lib\site-packages\utime\bin\init.py", line 134, in entry_func
run(parser.parse_args(args))
File "\Anaconda3\envs\u-sleep\lib\site-packages\utime\bin\init.py", line 128, in run
init_project_folder(default_folder, args.model, out_folder, data_dir)
File "\Anaconda3\envs\u-sleep\lib\site-packages\utime\bin\init.py", line 104, in init_project_folder
copy_yaml_and_set_data_dirs(in_file_path, out_file_path, data_dir)
File "\Anaconda3\envs\u-sleep\lib\site-packages\utime\bin\init.py", line 71, in copy_yaml_and_set_data_dirs
hparams.save_current(out_path)
File "\Anaconda3\envs\u-sleep\lib\site-packages\yamlhparams\yaml_hparams.py", line 152, in save_current
with open(out_path, "w") as out_f:
FileNotFoundError: [Errno 2] No such file or directory: 'C:\dataset_configurations\dcsm.yaml'

The issue is occurring in generating the out_file_path in init.py because when the sub directory dataset_configurations is derived there is a backslash "" at the beginning of the string, so os.path.join ignores the first entry.

I was able to fix the issue by editing the line 101 in init.py
sub_dir = dir_path.replace(hparams_in_dir, "").strip("/").strip('\\')

@Shubhamcl
Copy link

Happened to me on Windows but not on Linux, the fix does the job well.

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

2 participants