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

Problems using both binary STDIN and STDOUT #51

Closed
amotl opened this issue Mar 27, 2018 · 1 comment
Closed

Problems using both binary STDIN and STDOUT #51

amotl opened this issue Mar 27, 2018 · 1 comment

Comments

@amotl
Copy link

amotl commented Mar 27, 2018

Dear Kenneth,

Introduction

First things first: While staying for a while with the elder sister of Delegator.py, envoy, we salute you for giving this another attempt to finally regain sanity on Python subprocess handling. We are really looking forward to the outcome, cheers!

After successfully using it for a basic program called formailx.py, we just tried to apply Delegator.py to a slightly more advanced scenario.

Problem

We want to pipe binary data to the STDIN channel of a process and read its binary output from the STDOUT channel.

It is about image conversion using ImageMagick, so let's assume the command we want to execute is

convert - png:-

and we are trying to run Delegator.py like

with open(tiff_file, 'rb') as tiff:
    proc = delegator.run(command)
    proc.send(tiff.read())
    png = proc.out

Following the documentation, we also tried various combinations of the block and binary parameters and attempted to call proc.block() after proc.send(), but everything without success yet.

Status quo

We either get RuntimeError: send can only be used on non-blocking commands. as an answer or the program stalls completely when accessing proc.out .

On the other hand, everything works fine when using the pure subprocess module, see run_command in "util.py" from Patent2net/P2N#26.

Help?

Can we humbly ask you to take a look into this?
Thanks in advance for your efforts!

With kind regards,
Andreas.

@ParthS007
Copy link

Closing due to inactivity 👍

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