Argonne-National-Laboratory / PyGMI

Open source graphical interface for taking generic measurements over GPIB, USB, ethernet, serial...
Other
35 stars 9 forks source link

econde problem in Visual Studio #6

Open alberto-bueno opened 7 years ago

alberto-bueno commented 7 years ago

I normally run your program using spyder. But now I am migrating towards Visual Studio with Python tools 2015. Every time I launch PyGMI_Launcher.py I receive the following error:

self.config_dict['macfold']=self.ui.macfold.text().encode('utf'8) AttributeError: 'Qstring' object has no attribute 'encode'

captura

Max-Leroux commented 7 years ago

Hi,

so with pyQt and Qt 4.8 on my system, QLineEdit.text() returns a unicode string. But in your case it returns a QString. the simple fix then is to replace all the ".encode('utf8')" by the equivalent for Qstring that is ". toUtf8 http://pyqt.sourceforge.net/Docs/PyQt4/qstring.html#toUtf8()"

I believe this is due to one of the joy of PyQt/Qt: ever changing definitions breaking backward compatibility to keep you busy! Yeah!

Regards, Maxime

Max-Leroux commented 7 years ago

sorry it included the link, I meant ".toUtf8()"