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

Exceptions aren't shown when using apython in Ubuntu #11

Closed
rogpeppe opened this issue Nov 23, 2017 · 6 comments
Closed

Exceptions aren't shown when using apython in Ubuntu #11

rogpeppe opened this issue Nov 23, 2017 · 6 comments

Comments

@rogpeppe
Copy link

rogpeppe commented Nov 23, 2017

apython doesn't seem to show exceptions when they happen.
For example:

% apython
Python 3.5.2 (default, Nov 17 2016, 17:05:23) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
---
This console is running in an asyncio event loop.
It allows you to wait for coroutines using the 'await' syntax.
Try: await asyncio.sleep(1, result=3, loop=loop)
---
>>> raise Exception('foo')
>>>

I was hoping to be able to use apython for interactively debugging async Python code, but this makes it not nearly so useful.

@vxgmichel
Copy link
Owner

Thanks for your report! I didn't manage to reproduce this issue on a linux terminal. Are you using windows?

@rogpeppe
Copy link
Author

rogpeppe commented Dec 8, 2017

I'm using Ubuntu 16.04, and I just re-verified that the issue happens. I'm not sure
what version of apython I'm using though - I just followed standard install instructions.

vxgmichel added a commit that referenced this issue Dec 10, 2017
It ignores sys.excepthook (set by ubuntu apport for instance)
Fix issue #11
@vxgmichel vxgmichel changed the title apython: exceptions aren't shown Exceptions aren't shown when using apython in Ubuntu Dec 10, 2017
@vxgmichel
Copy link
Owner

vxgmichel commented Dec 10, 2017

I've been able to reproduce the issue, it's actually caused by the ubuntu "apport" thing.

It is now fixed starting with release v0.1.5.

Make sure you update your aioconsole package by running:

$ pip3 install -U aioconsole

Thanks again for the report!

@rogpeppe
Copy link
Author

Thanks very much. This seems to fix the issue for me. I'd love to see a more detailed description of what was going on here though. How was apport interfering with apython's exception reporting?

@vxgmichel
Copy link
Owner

That's because I was relying on code.InteractiveInterpreter.showtraceback, which performs the following check:

if sys.excepthook is sys.__excepthook__:
    self.write(''.join(lines))

Because of apport, sys.excepthook is sys.__excepthook__ evaluates to False in ubuntu.

See the source here.

@rogpeppe
Copy link
Author

Thanks, that's very good to know.

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

2 participants