Bug report #18171
Can't run python file from editor area in python-console
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
[python console] remove 'u' prefixes from strings (fix #18171)
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
Applied in changeset qgis|7823025b8d35a5310617ade996e1fb7cd60a9f50.