Skip to content

change the error message in runner #91

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

Closed
basnijholt opened this issue Dec 19, 2018 · 2 comments
Closed

change the error message in runner #91

basnijholt opened this issue Dec 19, 2018 · 2 comments

Comments

@basnijholt
Copy link
Member

(original issue on GitLab)

opened by Bas Nijholt (@basnijholt) at 2018-02-22T15:23:30.787Z

In line 155 in runner.py we can't rely on __name__ because a functools.partial object has no attribute __name__.

~/Work/induced_gap_B_field/adaptive/runner.py in _run()
    353                     except Exception as e:
    354                         raise RuntimeError(
--> 355                             'An error occured while evaluating '
    356                             f'"{self.learner.function.__name__}({x})". '
    357                             'See the top traceback for details.'

AttributeError: 'functools.partial' object has no attribute '__name__'

@jbweston

@basnijholt
Copy link
Member Author

originally posted by Bas Nijholt (@basnijholt) at 2018-02-22T15:32:48.953Z on GitLab

Maybe it should just be:

                    except Exception as e:
                        raise RuntimeError(
                            'An error occured while evaluating '
                            f'"learner.function({x})". '
                            'See the top traceback for details.'

@basnijholt
Copy link
Member Author

originally posted by Joseph Weston (@jbweston) at 2018-02-22T15:37:27.321Z on GitLab

that's a nice solution! Much cleaner than what I was thinking

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

1 participant