{"record":{"id":"50ba0985d9fa43d5","repo":"apache/seatunnel","slug":"python-source-stderr","errorCode":null,"errorMessage":"Python source stderr: {}","messagePattern":"Python source stderr: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"seatunnel-connectors-v2/connector-python/src/main/java/org/apache/seatunnel/connectors/seatunnel/python/source/PythonSourceReader.java","lineNumber":400,"sourceCode":"            writer.flush();\n        }\n    }\n\n    private void startStderrPump() {\n        stderrPumpThread =\n                new Thread(\n                        () -> {\n                            try (BufferedReader stderrReader =\n                                    new BufferedReader(\n                                            new InputStreamReader(\n                                                    process.getErrorStream(),\n                                                    StandardCharsets.UTF_8))) {\n                                String line;\n                                int loggedLines = 0;\n                                while ((line = stderrReader.readLine()) != null) {\n                                    appendStderrLine(line);\n                                    if (loggedLines < STDERR_HISTORY_LIMIT) {\n                                        LOG.warn(\"Python source stderr: {}\", line);\n                                    } else if (loggedLines == STDERR_HISTORY_LIMIT) {\n                                        LOG.warn(\n                                                \"Suppressing further Python source stderr lines for this process\");\n                                    }\n                                    loggedLines++;\n                                }\n                            } catch (IOException e) {\n                                if (!closeRequested && !stderrShutdownRequested) {\n                                    stderrPumpFailure = e;\n                                }\n                            }\n                        },\n                        \"python-source-stderr-pump\");\n        stderrPumpThread.setDaemon(true);\n        stderrPumpThread.start();\n    }\n\n    private void startStdoutPump() {","sourceCodeStart":382,"sourceCodeEnd":418,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-python/src/main/java/org/apache/seatunnel/connectors/seatunnel/python/source/PythonSourceReader.java#L382-L418","documentation":"PythonSourceReader's stderr pump thread reads the Python process's stderr line by line and logs each line at WARN as 'Python source stderr: {}'. This surfaces error output (tracebacks, library errors) from the embedded Python interpreter so failures are visible in SeaTunnel logs.","triggerScenarios":"open() starts the stderr pump; any line the Python source process writes to stderr triggers the log — e.g. pip/import errors, unhandled Python exceptions, warnings printed to stderr.","commonSituations":"Missing Python dependencies in the python execution environment; syntax errors in the Python script; Python version mismatch; script writing progress/info messages to stderr (normal practice in Unix tooling).","solutions":["Read the logged line to identify the Python-side problem — usually an import error or exception traceback from the script.","Install missing Python dependencies in the environment the process runs in (matching the Python used by the connector).","Fix the Python source script so it does not write benign output to stderr (use logging to a file or stdout for info).","Check PYTHONPATH/python interpreter configuration for the connector; ensure the script path and interpreter are correct."],"exampleFix":"// before (Python script)\nprint('progress 50%', file=sys.stderr)\n// after\nprint('progress 50%')  # or use logging to a file, not stderr","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Test the Python script standalone and confirm it runs without stderr output","Pre-install all Python dependencies in the execution environment","Redirect benign script output away from stderr"],"tags":["python","stderr","process","logging"],"backgroundTag":"python-process-stderr","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}