Skip to main content

Timeline for Read output of a Python subprocess

Current License: CC BY-SA 4.0

10 events
when toggle format what by license comment
Jul 7, 2022 at 3:01 history tweeted twitter.com/StackBlender/status/1544879196794720256
Jul 4, 2022 at 8:28 answer added Billy Bobby Joey timeline score: 2
Jun 28, 2022 at 10:53 comment added Jakemoyo My initial thought was to try to implement a modal, which is like Blender's own version of an event_loop. It took me a sec to get you wss.py working on my end, and while just transferring your code into a modal operator doesn't work straight out of the box, I did find a bit more fleshed out version of the same idea on this github repo that i think might solve your solution, or get you closer at least.
Jun 28, 2022 at 8:42 comment added GreatCorn @Jakemoyo The code hangs at server.stdout.readline() until I manually stop the python.exe process, which is running wss.py. I put the breakpoint before the call and stepping once froze pdb too. After stopping the process, pdb didn't reveal anything more than Blender's default drawing methods.
Jun 27, 2022 at 18:00 comment added Jakemoyo pdb is the builtin debugging tool for python. Usually you put a line like import pdb; pdb.set_trace() above where you want to set a breakpoint and then run the program, and you can step through each line of code being executed and see where it's getting stuck. That might give you a bit more insight on what's holding it up.
Jun 27, 2022 at 15:30 comment added GreatCorn @Jakemoyo I'm sorry, as I am not very familiar with Python, so I don't really know what I should expect from pdb. Setting a timeout will always result in TimeoutExpired and no value returned by communicate().
Jun 27, 2022 at 14:38 comment added Jakemoyo I also wonder if it's possible to use Popen.communicate() to set an explicit timeout to possibly snap it out of the async loop?
Jun 27, 2022 at 14:36 comment added Jakemoyo Have you tried using a pdb.set_trace() to see where exactly in the code it's hanging? I'm wondering if it's getting stuck inside the wss.py file or if it's something going on in the source code of the stdout.readline() method.
S Jun 27, 2022 at 14:21 review First questions
Jun 27, 2022 at 14:38
S Jun 27, 2022 at 14:21 history asked GreatCorn CC BY-SA 4.0