[PyQt] QProcess problems/question
apaku at gmx.de
Tue Jun 17 20:15:54 BST 2008
On 17.06.08 15:52:02, Gustavo A. Díaz wrote:
> But the command is not being executed since i still have the export of the
> proxy variables empty.
> What i am doing wrong here?
You don't understand how processes and environment variables work.
QProcess forks a new child process to execute the command you give it.
Problem one: "export ..." is not a command, its a shell builtin function
(bash probably) and thus won't do anything on its own. So you'd at least
need to use something like "bash -c 'export ...'" as command. Next
problem is that "export" only works in the shell and any shells that are
started from the shell its been executed in. It doesn't have any
influence on any other shell running on your machine and thus doesn't
have any influence on any other process that you execute via QProcess or
anywhere else in your system. If you want to start an application that
uses these variables, you should start the application via QProcess and
use QProcess' functions to set the environment variables (IIRC
setEnvironment()). Thats the only way to do this.
Exercise caution in your daily affairs.
More information about the PyQt