[PyQt] Conversion between QString and string

Kakada hokkakada at khmeros.info
Thu Jan 3 19:02:24 GMT 2008


Hi Tiago,

try this:

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

dada
On Monday 24 December 2007 04:24:07 Tiago Maluta wrote:
> 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
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt




More information about the PyQt mailing list