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

wurlitzer tries to __enter__ multiple times #27

Closed
impact27 opened this issue Jun 4, 2019 · 0 comments · Fixed by #28
Closed

wurlitzer tries to __enter__ multiple times #27

impact27 opened this issue Jun 4, 2019 · 0 comments · Fixed by #28

Comments

@impact27
Copy link
Contributor

impact27 commented Jun 4, 2019

I am not sure exactly how I manage to get this error, but here is the traceback I get:

Error in callback <function sys_pipes_forever at 0x11a0d49d8> (for pre_execute):

Traceback (most recent call last):

  File "/usr/local/lib/python3.7/site-packages/wurlitzer.py", line 320, in sys_pipes_forever
    _mighty_wurlitzer.__enter__()

  File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/contextlib.py", line 110, in __enter__
    del self.args, self.kwds, self.func

AttributeError: args

Looking at the sys_pipes_forever function, it looks like __enter__ is called even if wurlitzer already called __enter__. As pointed out in the comment above line 110:

        # do not keep args and kwds alive unnecessarily
        # they are only needed for recreation, which is not possible anymore

This means that __enter__ can not be called more than once.

Maybe this could be fixed by changing the indentation of line 320?

impact27 added a commit to impact27/wurlitzer that referenced this issue Jun 4, 2019
@minrk minrk closed this as completed in #28 Jun 13, 2019
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

Successfully merging a pull request may close this issue.

1 participant