<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body>
    Hi,<br>
    <br>
    A student of mine is reporting issues with the Python editor (both
    in 3.4, 3.10, and 3.14):<br>
    <br>
    No matter what code he executes (even print("Hallo world!")), he
    always gets "ResourceWarning: unclosed file"<br>
    <br>
    <pre>--- Logging error ---</pre>
    <pre>Traceback (most recent call last):</pre>
    <pre>  File "C:\PROGRA~1\QGIS3~1.10\apps\Python37\lib\logging\__init__.py", line 985, in emit</pre>
    <pre>    stream.write(msg)</pre>
    <pre>AttributeError: 'NoneType' object has no attribute 'write'</pre>
    <pre>Call stack:</pre>
    <pre>  File "C:/PROGRA~1/QGIS3~1.10/apps/qgis-ltr/./python\console\console.py", line 579, in runScriptEditor</pre>
    <pre>    self.tabEditorWidget.currentWidget().newEditor.runScriptCode()</pre>
    <pre>  File "C:/PROGRA~1/QGIS3~1.10/apps/qgis-ltr/./python\console\console_editor.py", line 633, in runScriptCode</pre>
    <pre>    .format(filename.replace("\\", "/"), sys.getfilesystemencoding()))</pre>
    <pre>  File "C:/PROGRA~1/QGIS3~1.10/apps/qgis-ltr/./python\console\console_sci.py", line 631, in runCommand</pre>
    <pre>    more = self.runsource(src)</pre>
    <pre>  File "C:/PROGRA~1/QGIS3~1.10/apps/qgis-ltr/./python\console\console_sci.py", line 661, in runsource</pre>
    <pre>    return super(ShellScintilla, self).runsource(source, filename, symbol)</pre>
    <pre>  File "C:\PROGRA~1\QGIS3~1.10\apps\Python37\lib\code.py", line 74, in runsource</pre>
    <pre>    self.runcode(code)</pre>
    <pre>  File "C:\PROGRA~1\QGIS3~1.10\apps\Python37\lib\code.py", line 90, in runcode</pre>
    <pre>    exec(code, self.locals)</pre>
    <pre>  File "<input>", line 1, in <module></pre>
    <pre>  File "C:\PROGRA~1\QGIS3~1.10\apps\Python37\lib\warnings.py", line 99, in _showwarnmsg</pre>
    <pre>    msg.file, msg.line)</pre>
    <pre>Message: '%s'</pre>
    <pre>Arguments: ("__console__:1: ResourceWarning: unclosed file <_io.TextIOWrapper name=b'C:/Users/xxx/AppData/Local/Temp/tmp9odm0iq6.py' mode='r' encoding='UTF-8'>\n",)</pre>
    <p><br>
    </p>
    <p>So far, all attempts at a clean new install have failed. Do you
      have any pointers for how to get rid of this error?</p>
    <p>Regards,</p>
    <p>Anita</p>
    <p><br>
    </p>
    <br>
    <p><br>
    </p>
  </body>
</html>