marrink-lab / polyply_1.0

Generate input parameters and coordinates for atomistic and coarse-grained simulations of polymers, ssDNA, and carbohydrates
Apache License 2.0
122 stars 21 forks source link

Behavior when omitting the `-o` argument #283

Closed ricalessandri closed 1 year ago

ricalessandri commented 1 year ago

Describe the bug If the gen_params is called while omitting the -o flag, polyply runs but fails with the following.

Traceback (most recent call last):
  File "/Users/alessandri/miniconda3/envs/polyply/bin/polyply", line 258, in <module>
    main()
  File "/Users/alessandri/miniconda3/envs/polyply/bin/polyply", line 254, in main
    subprogram(**args_dict)
  File "/Users/alessandri/miniconda3/envs/polyply/lib/python3.10/site-packages/polyply/src/gen_itp.py", line 112, in gen_params
    with deferred_open(outpath, 'w') as outfile:
  File "/Users/alessandri/miniconda3/envs/polyply/lib/python3.10/site-packages/vermouth/file_writer.py", line 93, in open
    path = pathlib.Path(filename)
  File "/Users/alessandri/miniconda3/envs/polyply/lib/python3.10/pathlib.py", line 958, in __new__
    self = cls._from_parts(args)
  File "/Users/alessandri/miniconda3/envs/polyply/lib/python3.10/pathlib.py", line 592, in _from_parts
    drv, root, parts = self._parse_args(args)
  File "/Users/alessandri/miniconda3/envs/polyply/lib/python3.10/pathlib.py", line 576, in _parse_args
    a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not NoneType 

version: polyply version 1.0.1.dev617

Command line arguments

polyply gen_params -f XXX.ff -name XXX -seq XXX:10 

Expected behavior I thought it would just either have a default name or require the -o argument to be passed. If this is fine, then I'd just improve a little the error message (that is currently a little cryptic to the less python-versed people) .