[Eric] utf-8 magic with Eric (and trouble without)
Georg Drees
tuxlifan at gmail.com
Fri Jan 30 19:17:36 GMT 2009
Hello list,
I'm perplexed as to why the following script runs fine
when called from within Eric ("Run Script") but raises
an Error when run from the command line.
The Error also occurs when I remove the line specifying
the encoding and run it from within Eric.
---snip main.pyw---
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import PyQt4
from PyQt4 import QtCore, QtGui
from PyQt4.QtCore import QString
if __name__=="__main__":
app = QtGui.QApplication(sys.argv)
w = QtGui.QLabel()
w.setText(QString.fromUtf8(u'\u2192'))
w.show()
sys.exit(app.exec_())
---snap---
This is the output I get:
---snip---
example$ python ./main.pyw
Traceback (most recent call last):
File "./main.pyw", line 13, in <module>
w.setText(QString.fromUtf8(u'\u2192'))
TypeError: argument 1 of QString.fromUtf8() has an invalid type
---snap---
Thanks!
Georg
P.S.:
Arch Linux
Eric4 4.2.5 (r2785)
Python 2.6.1 (both standalone and within Eric)
PyQt4 4.4.4
--
tuXLifan
More information about the Eric
mailing list