python - PyQt Qstring not accepted when script run from WIndows command line, why? -
using pyqt 4, python 2.7, windows 7 on x64 machine.
i have been developing bit of code using python console pyqt4 , passing strings qlineedit() widgets os commands no issues using os.system(cmd)
but when tried running command line in windows following error,
typeerror: sequence item 0: expected string, qstring found
i got around converting offending string via str(cmd)
has left me curious about, why should happen when code called command line , not when called within python console?
i'm not sure why happening (given you're using standard python console), possible configure pyqt methods return python strings rather qstrings
. suspect python console doing this, script not. again, can't see why normal python console automatically, unless our definition of normal python console somehow different (by normal console mean running python.exe
terminal). however, explanation have short of running different code in console , not realising.
so, pyqt documentation covers how disable qstrings
using sip
module. before importing pyqt4.
import sip sip.setapi('qstring', 2)
if in python script, should identical behaviour between console , command line.
you can similar thing disable qvariant
, other annoying qt types pointless in python.
Comments
Post a Comment