[PyQt] Conversion between QString and string

Tiago Maluta maluta_tiago at yahoo.com.br
Sun Dec 23 21:24:07 GMT 2007


Hi,
In order to use a popen function, I need convert a QString in python
string to use as argument.

My code was:

	# self.command = "program " + self.MyLineEdit.text()
	# p_output = os.popen(self.command)

And I got:

	> TypeError: popen() argument 1 must be string, not QString


because self.command is QString I tried change the type with ascii() method:

	# self.command = "program " + self.MyLineEdit.text()
	# p_output = os.popen(self.command.ascii())

But I still got (another) error message:

	> p_output = os.popen(self.command.ascii())
	> AttributeError: ascii



best regards,

- tiago


More information about the PyQt mailing list