Relative Content

Tag Archive for pythonsubprocess

Avoiding fork() memory issues when running external commands from a large Python process

I’m maintaining a memory-intensive Python application that occasionally needs to execute external commands (e.g., ls -l) and capture their output. The legacy code uses subprocess.Popen for this purpose. However, I’ve observed that sometimes the command execution fails, and I suspect it’s because Popen uses fork() under the hood on Linux systems.

Unexpected behavior of msmtp with subprocess

I want to send emails from my python code calling msmtp using subprocess. Some of the emails are longish (maybe a few kB’s, but not insanely long). The following code works fine with maybe 10 lines of email, but with any more than that then the email is sent Ok with correct subject but no body text at all.

Unexpected behavior of msmtp with subprocess

I want to send emails from my python code calling msmtp using subprocess. Some of the emails are longish (maybe a few kB’s, but not insanely long). The following code works fine with maybe 10 lines of email, but with any more than that then the email is sent Ok with correct subject but no body text at all.