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

unexpected keyword argument 'add_extension' when a YAML file is named '*.yml' #357

Closed
frexvahi opened this issue May 12, 2017 · 5 comments
Closed
Milestone

Comments

@frexvahi
Copy link

$ smt run --executable=/usr/bin/python3 --main=job.py data.yml
Traceback (most recent call last):
  File "/home/cjk/.conda/envs/sumatra/bin/smt", line 31, in <module>
    main(sys.argv[2:])
  File "/home/cjk/.conda/envs/sumatra/lib/python2.7/site-packages/sumatra/commands.py", line 403, in run
    version=args.version or 'current')
  File "/home/cjk/.conda/envs/sumatra/lib/python2.7/site-packages/sumatra/projects.py", line 217, in launch
    record.run(with_label=self.data_label)
  File "/home/cjk/.conda/envs/sumatra/lib/python2.7/site-packages/sumatra/records.py", line 153, in run
    self.parameter_file = self.executable.write_parameters(self.parameters, parameter_file_basename)
  File "/home/cjk/.conda/envs/sumatra/lib/python2.7/site-packages/sumatra/programs.py", line 126, in write_parameters
    filename = parameters.save(filebasename, add_extension=True)
TypeError: save() got an unexpected keyword argument 'add_extension'
@frexvahi
Copy link
Author

frexvahi commented May 12, 2017

job.py is just print("Hello, world!"). data.yml is some random YAML.

$ cat data.yml
a:
  b:
  - 3
  - 7

@frexvahi
Copy link
Author

After renaming to 'data.yaml' it works

$ smt run --executable=/usr/bin/python3 --main=job.py data.yaml
Hello, world
Record label for this run: '20170512-175829'
No data produced.

@frexvahi
Copy link
Author

frexvahi commented May 12, 2017

This happens both with the latest release (pip install sumatra) and the github master (pip install git+ssh://[email protected]/open-research/sumatra.git)

@frexvahi
Copy link
Author

frexvahi commented May 12, 2017

Running in the debugger shows that the parameters file has been detected as a NTParameterSet. The YAML has however been parsed correctly.

$ python -m pdb `which smt` run --executable=/usr/bin/python3 --main=job.py data.yml
> /home/cjk/.conda/envs/sumatra/bin/smt(4)<module>()
-> """
(Pdb) c
Traceback (most recent call last):
 . . .
TypeError: save() got an unexpected keyword argument 'add_extension'
Uncaught exception. Entering post mortem debugging
Running 'cont' or 'step' will restart the program
> /home/cjk/.conda/envs/sumatra/lib/python2.7/site-packages/sumatra/programs.py(126)write_parameters()
-> filename = parameters.save(filebasename, add_extension=True)
(Pdb) p type(parameters)
<class 'sumatra.parameters.NTParameterSet'>
(Pdb) p parameters
{'a': {'b': [3, 7]}}

@apdavison
Copy link
Contributor

The specific error was fixed in #359, so you should be ok with the latest master.

The file is still not detected as a YAML file, however. I've created #367 to address this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants