0

I have a TKinter program that awaits stdin and then does an action based on the stream of inputs. Then I have a node.js program that scrapes a webpage every hour and based on that, writes to stdout. Is there a way I can set up these two processes to communicate with each other in real time?

2
  • Are you able to change a logic a bit an use file for your needs instead of i/o?...or you can use redis or something like that Commented Apr 18, 2020 at 22:13
  • @DmytroHuz because that's very inefficient and requires a setup (or a service subscription). Commented Apr 19, 2020 at 21:36

1 Answer 1

1

You can use the python-bridge module that I found some time ago in a similar situation and execute some python code from node. The module will keep a python process for you that you'll be able to call directly from node and you'll also get your arguments translated to python (with deep references, which is quite cool).

It has a nice Promise and template string based API so you can use it in an async function:

await python.ex`import somemodule`
await python.ex`someFunction(${javascripArgument})`

I actually used that in one of my modules, but it's currently not operational (there are some errors that I need to understand, since it used to work) - but see these lines in scramjet-python-module.

The only remark I have that this module hasn't been updated in a year, but it doesn't seem that it'd need to - it seems safe to use to me.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.