esi-neuroscience / acme

Asynchronous Computing Made ESI
https://esi-acme.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
11 stars 2 forks source link

Strange error message with n_inputs=0 #11

Closed KatharineShapcott closed 3 years ago

KatharineShapcott commented 3 years ago

Hi Stephan, I accidentally set n_inputs to 0 which is outside the permissible range and acme should exit gracefully. But instead I got this output:

./acme/acme/__init__.py:29: ImportWarning: <ACME> Package is not installed in site-packages nor cloned via git. Please consider obtaining ACME sources from supported channels. 
  warnings.showwarning(msg, ImportWarning, __file__, inspect.currentframe().f_lineno)
Traceback (most recent call last):
  File "filter_net_paper.py", line 371, in <module>
    main()
  File "filter_net_paper.py", line 224, in main
    with ParallelMap(comparison_preprocessing, clf_in, data_train, label_train, data_test, n_filters=multifilter_n_filters, n_inputs=0, write_worker_results=write) as pmap:
  File "./acme/acme/frontend.py", line 53, in __init__
    self.prepare_input(func, n_inputs, *args, **kwargs)
  File "./acme/acme/frontend.py", line 80, in prepare_input
    raise exc
  File "./acme/acme/frontend.py", line 78, in prepare_input
    acs._scalar_parser(n_inputs, varname="n_inputs", ntype="int_like", lims=[1, np.inf])
  File "./acme/acme/shared.py", line 101, in _scalar_parser
    raise ValueError(msg.format(caller=caller,
ValueError: Unknown format code 's' for object of type 'int'

I wonder if acs._scalar_parser isn't working properly there for some reason?

Best, Katharine

pantaray commented 3 years ago

Hey Katharine! Nice... I think the parser does what it's supposed to do, but the generated error message triggers an exception due to a wrong string format code resulting in an exception that is completely opaque and illegible. Will fix this, thanks for reporting!