question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

generator already executing

See original GitHub issue

Describe the bug ValueError: generator already executing

To Reproduce Make a lot of conversion maybe?

Expected behavior No error

Desktop (please complete the following information):

  • OS: Docker python:3.7-stretch
  • Version 1.11.0

Code:

Where pdf var is a typing.IO[bytes] stream

pdf_content = pdf.read() 
images = convert_from_bytes(pdf_content)

Output:

File "/usr/local/lib/python3.7/site-packages/****, line ****, in ****
images = convert_from_bytes(pdf_content)
File "/usr/local/lib/python3.7/site-packages/pdf2image/pdf2image.py", line 269, in convert_from_bytes
 paths_only=paths_only,
 File "/usr/local/lib/python3.7/site-packages/pdf2image/pdf2image.py", line 144, in convert_from_path
thread_output_file = next(output_file)
ValueError: generator already executing

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Belvalcommented, Jan 17, 2020

The timeout is a good idea, if the problem is reported again I will consider adding one by default or at least making it a parameter.

1reaction
L3o-poldcommented, Jan 14, 2020

It came from this project https://github.com/algoo/preview-generator/blob/develop/preview_generator/preview/builder/pdf__pypdf2.py#L56

On top of that I have a multithreaded webserver.

CRITICAL:root:generator already executing
Traceback (most recent call last):
  File "script.py", line 70, in get_thumbnail
    image_path, height=payload.get('height', 200), width=payload.get('width', 200)
  File "/usr/local/lib/python3.7/site-packages/preview_generator/manager.py", line 176, in get_jpeg_preview
    mimetype=mimetype,
  File "/usr/local/lib/python3.7/site-packages/preview_generator/preview/builder/pdf__pypdf2.py", line 56, in build_jpeg_preview
    result = convert_pdf_to_jpeg(output_stream, size)
  File "/usr/local/lib/python3.7/site-packages/preview_generator/preview/builder/image__wand.py", line 20, in convert_pdf_to_jpeg
    images = convert_from_bytes(pdf_content)
  File "/usr/local/lib/python3.7/site-packages/pdf2image/pdf2image.py", line 269, in convert_from_bytes
    paths_only=paths_only,
  File "/usr/local/lib/python3.7/site-packages/pdf2image/pdf2image.py", line 144, in convert_from_path
    thread_output_file = next(output_file)
ValueError: generator already executing
Read more comments on GitHub >

github_iconTop Results From Across the Web

python - builtins.ValueError: generator already executing
This happens because your distinct generator refers to itself inside of its body: if not variable in distinct . ... In other words,...
Read more >
Python - generator already executing - Neo4j - 40421
ValueError: generator already executing is raised when multiple threads try to consume from one generator. Note that the driver object is thread ...
Read more >
Value error generator already executing · Issue #14 - GitHub
I am using this code where I can display multiple streams using urls like localhost:5000/1 and localhost:5000/2 I used this repository for ...
Read more >
"generator already executing" when operating on a stream
I am writing a custom ner.make-gold recipe. I am replacing the stream = split_sentences(stream) call with my own segment_documents() ...
Read more >
generator docs should mention already-executing exception
I think the generator.__next__() documentation should say that it raises an exception if the generator is already executing: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found