Skip to content
This repository has been archived by the owner on Jul 5, 2020. It is now read-only.

File reader should error when it can't open a file #39

Open
keith923 opened this issue Jul 7, 2016 · 0 comments
Open

File reader should error when it can't open a file #39

keith923 opened this issue Jul 7, 2016 · 0 comments
Assignees

Comments

@keith923
Copy link
Contributor

keith923 commented Jul 7, 2016

Currently when the file reader plugin is given a non-existent file it just hangs. When you hit ^C the following is printed to io.mc:

2016-07-07 11:51:25,658 Task exception was never retrieved
future: <Task finished coro=<ReadFile.run() done, defined at /Users/d3x923/Documents/projects/apbs/sphinx/plugins/ReadFile/plugin.py:118> exception=FileNotFoundError(2, 'No such file or directory') created at /Users/d3x923/Documents/projects/apbs/sphinx/sphinx/core/coordinator.py:135>
source_traceback: Object created at (most recent call last):
  File "apbs.py", line 109, in <module>
    sys.exit(main())
  File "apbs.py", line 100, in main
    coordinator.start(cmd, args, debug=debug)
  File "/Users/d3x923/Documents/projects/apbs/sphinx/sphinx/core/coordinator.py", line 99, in start
    exec(code, self._plugin_funcs, {'params':locals})
  File "example/run_pdb2pqr.apbs", line 3, in <module>
    pdb = read_file(params['pdb'])
  File "/Users/d3x923/Documents/projects/apbs/sphinx/plugins/ReadFile/plugin.py", line 77, in __init__
    super().__init__(**kwargs)
  File "/Users/d3x923/Documents/projects/apbs/sphinx/sphinx/plugin/base.py", line 104, in __init__
    self._task = self.runner.create_task(self.run())
  File "/Users/d3x923/Documents/projects/apbs/sphinx/sphinx/core/coordinator.py", line 135, in create_task
    task = self._loop.create_task(func)
Traceback (most recent call last):
  File "/usr/local/Cellar/python3/3.5.2/Frameworks/Python.framework/Versions/3.5/lib/python3.5/asyncio/tasks.py", line 239, in _step
    result = coro.send(None)
  File "/Users/d3x923/Documents/projects/apbs/sphinx/plugins/ReadFile/plugin.py", line 121, in run
    file = yield from self.open()
  File "/usr/local/Cellar/python3/3.5.2/Frameworks/Python.framework/Versions/3.5/lib/python3.5/asyncio/coroutines.py", line 206, in coro
    res = func(*args, **kw)
  File "/Users/d3x923/Documents/projects/apbs/sphinx/plugins/ReadFile/plugin.py", line 102, in open
    return open(self._file, 'r')
FileNotFoundError: [Errno 2] No such file or directory: '1fas'
2016-07-07 11:51:25,660 Task was destroyed but it is pending!
source_traceback: Object created at (most recent call last):
  File "apbs.py", line 109, in <module>
    sys.exit(main())
  File "apbs.py", line 100, in main
    coordinator.start(cmd, args, debug=debug)
  File "/Users/d3x923/Documents/projects/apbs/sphinx/sphinx/core/coordinator.py", line 99, in start
    exec(code, self._plugin_funcs, {'params':locals})
  File "example/run_pdb2pqr.apbs", line 6, in <module>
    pdb.write_stdout()
  File "/Users/d3x923/Documents/projects/apbs/sphinx/plugins/WriteStdout/plugin.py", line 58, in __init__
    super().__init__(**kwargs)
  File "/Users/d3x923/Documents/projects/apbs/sphinx/sphinx/plugin/base.py", line 104, in __init__
    self._task = self.runner.create_task(self.run())
  File "/Users/d3x923/Documents/projects/apbs/sphinx/sphinx/core/coordinator.py", line 135, in create_task
    task = self._loop.create_task(func)
task: <Task pending coro=<WriteStdout.run() done, defined at /Users/d3x923/Documents/projects/apbs/sphinx/plugins/WriteStdout/plugin.py:77> wait_for=<Future cancelled created at /usr/local/Cellar/python3/3.5.2/Frameworks/Python.framework/Versions/3.5/lib/python3.5/asyncio/base_events.py:252> cb=[_wait.<locals>._on_completion() at /usr/local/Cellar/python3/3.5.2/Frameworks/Python.framework/Versions/3.5/lib/python3.5/asyncio/tasks.py:414] created at /Users/d3x923/Documents/projects/apbs/sphinx/sphinx/core/coordinator.py:135>

There is an exception buried in there, and it's not being propagated. There is some magic to properly deal with exceptions when using asyncio.

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

No branches or pull requests

1 participant