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

Greenlet cannot switch to different thread #784

Open
markf94 opened this issue Nov 19, 2019 · 1 comment
Open

Greenlet cannot switch to different thread #784

markf94 opened this issue Nov 19, 2019 · 1 comment

Comments

@markf94
Copy link

@markf94 markf94 commented Nov 19, 2019

I'm trying to use progressbar in combination with the AWS API boto3. When downloading a file from AWS S3 a callback can be used to track the progress of the download. When streaming this into progressbar.Progressbar bpython fails on me with the following stacktrace:

  File "/home/markf94/.local/lib/python3.7/site-packages/s3transfer/futures.py", line 106, in result
    return self._coordinator.result()
  File "/home/markf94/.local/lib/python3.7/site-packages/s3transfer/futures.py", line 265, in result
    raise self._exception
  File "/home/markf94/.local/lib/python3.7/site-packages/s3transfer/tasks.py", line 126, in __call__
    return self._execute_main(kwargs)
  File "/home/markf94/.local/lib/python3.7/site-packages/s3transfer/tasks.py", line 150, in _execute_main
    return_value = self._main(**kwargs)
  File "/home/markf94/.local/lib/python3.7/site-packages/s3transfer/download.py", line 523, in _main
    for chunk in chunks:
  File "/home/markf94/.local/lib/python3.7/site-packages/s3transfer/download.py", line 651, in __next__
    chunk = self._body.read(self._chunksize)
  File "/home/markf94/.local/lib/python3.7/site-packages/s3transfer/utils.py", line 546, in read
    invoke_progress_callbacks(self._callbacks, len(value))
  File "/home/markf94/.local/lib/python3.7/site-packages/s3transfer/utils.py", line 141, in invoke_progress_callbacks
    callback(bytes_transferred=bytes_transferred)
  File "/usr/local/lib/python3.7/site-packages/boto3/s3/transfer.py", line 338, in on_progress
    self._callback(bytes_transferred)
  File "/home/markf94/proteinqure/code/platform/warehouse/pq_warehouse/factories.py", line 173, in __call__
    sys.stdout.write('\r' + TERM_UP_ONE_LINE + TERM_CLEAR_LINE)
  File "/usr/lib/python3.7/site-packages/bpython/curtsiesfrontend/coderunner.py", line 220, in write
    return self.coderunner.request_from_main_context(force_refresh=True)
  File "/usr/lib/python3.7/site-packages/bpython/curtsiesfrontend/coderunner.py", line 195, in request_from_main_context
    value = self.main_context.switch(Refresh())
greenlet.error: cannot switch to a different thread
@markf94
Copy link
Author

@markf94 markf94 commented Nov 19, 2019

Works perfectly fine in the normal python3 interpreter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.