Bug report #20427

Python console behaves strange

Added by Alexey T about 4 years ago. Updated about 4 years ago.

Category:PyQGIS Console
Affected QGIS version:3.4.1 Regression?:No
Operating System:Win7 Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:28247


I wrote a function in a python script file.
Then I executed it via "Run Script" button in python console editor
Function threw an error.
Then I fixed this error, saved file and executed script again.
But console sees old function and continues to throw a nerror.


#1 Updated by Alexey T about 4 years ago

May be it is related to this warning dispalyed in "Log Messages" panel

018-11-10T00:33:34 WARNING warning:__console__:1: ResourceWarning:

unclosed file
traceback: File "C:/PROGRA~1/QGIS3~1.4/apps/qgis/./python\console\console.py", line 575, in runScriptEditor
File "C:/PROGRA~1/QGIS3~1.4/apps/qgis/./python\console\console_editor.py", line 629, in runScriptCode
.format(filename.replace("\\", "/"), sys.getfilesystemencoding()))
File "C:/PROGRA~1/QGIS3~1.4/apps/qgis/./python\console\console_sci.py", line 635, in runCommand
more = self.runsource(src)
File "C:/PROGRA~1/QGIS3~1.4/apps/qgis/./python\console\console_sci.py", line 665, in runsource
return super(ShellScintilla, self).runsource(source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.4\apps\Python37\lib\code.py", line 74, in runsource
File "C:\PROGRA~1\QGIS3~1.4\apps\Python37\lib\code.py", line 90, in runcode
exec(code, self.locals)
File "", line 1, in

Also available in: Atom PDF