Bug report #18171

Can't run python file from editor area in python-console

Added by Josef Fällman over 6 years ago. Updated over 6 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:PyQGIS Console
Affected QGIS version:master Regression?:No
Operating System:Windows Easy fix?:Yes
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:26062

Description

When python-console is open, i open the editor area, create a small script like:
print("hello")

Running this file directly works fine, but if i save it, and the path contains special characters.

one solution would be to change line
exec(open(u'C:/åäö/testfile.py'.encode('utf-8')).read())
to
exec(open('C:/åäö/testfile.py').read())

This probably because default string behavior in Python 3

Associated revisions

Revision 7823025b
Added by Alexander Bruy over 6 years ago

[python console] remove 'u' prefixes from strings (fix #18171)

Revision f93dc908
Added by Alexander Bruy over 6 years ago

Merge pull request #6434 from alexbruy/python-console

[python console] remove 'u' prefixes from strings (fix #18171)

History

#1 Updated by Alexander Bruy over 6 years ago

  • % Done changed from 0 to 100
  • Status changed from Open to Closed

Also available in: Atom PDF