Hi,

A student of mine is reporting issues with the Python editor (both in
3.4, 3.10, and 3.14):

No matter what code he executes (even print("Hallo world!")), he always
gets "ResourceWarning: unclosed file"

--- Logging error ---

Traceback (most recent call last):

  File "C:\PROGRA~1\QGIS3~1.10\apps\Python37\lib\logging\__init__.py", line 
985, in emit

    stream.write(msg)

AttributeError: 'NoneType' object has no attribute 'write'

Call stack:

  File "C:/PROGRA~1/QGIS3~1.10/apps/qgis-ltr/./python\console\console.py", line 
579, in runScriptEditor

    self.tabEditorWidget.currentWidget().newEditor.runScriptCode()

  File 
"C:/PROGRA~1/QGIS3~1.10/apps/qgis-ltr/./python\console\console_editor.py", line 
633, in runScriptCode

    .format(filename.replace("\\", "/"), sys.getfilesystemencoding()))

  File "C:/PROGRA~1/QGIS3~1.10/apps/qgis-ltr/./python\console\console_sci.py", 
line 631, in runCommand

    more = self.runsource(src)

  File "C:/PROGRA~1/QGIS3~1.10/apps/qgis-ltr/./python\console\console_sci.py", 
line 661, in runsource

    return super(ShellScintilla, self).runsource(source, filename, symbol)

  File "C:\PROGRA~1\QGIS3~1.10\apps\Python37\lib\code.py", line 74, in runsource

    self.runcode(code)

  File "C:\PROGRA~1\QGIS3~1.10\apps\Python37\lib\code.py", line 90, in runcode

    exec(code, self.locals)

  File "<input>", line 1, in <module>

  File "C:\PROGRA~1\QGIS3~1.10\apps\Python37\lib\warnings.py", line 99, in 
_showwarnmsg

    msg.file, msg.line)

Message: '%s'

Arguments: ("__console__:1: ResourceWarning: unclosed file <_io.TextIOWrapper 
name=b'C:/Users/xxx/AppData/Local/Temp/tmp9odm0iq6.py' mode='r' encoding='UTF-8'>\n",)


So far, all attempts at a clean new install have failed. Do you have any
pointers for how to get rid of this error?

Regards,

Anita




_______________________________________________
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

Reply via email to