You are not logged in.

#1 2012-07-18 09:44:16

perezpt
Member
Registered: 2012-07-18
Posts: 1

HELP - Building a Pacman GUI - Python

Hello everyone.

I'm trying build a pacman GUI using python language.
GUI -> glade
I'm with problems with the python/shell communication.

I tried popen and pexpect for to do  communication, but seems that none of this worked.
I cant to use popen.communicate because popen.communicate finish the process instantly.
Now i'm trying use pexpect, but this isnt working.
Program should work something like this:

>pacman command -> "create new process" (python send the command to the terminal and it's created the "new process")
>while "new process" isnt dead {
>python capture the output from the "new process"
> "new process" should send to the python something that say "I WANT AN INPUT" -> this may not be necessary, i dont know :s
> (user write an input) python send the input to the "new process"
> "new process" should send signal that indicate that isnt dead
}

My qestions are:
There is anyway to do the communication like I said?
What should I do? i need advices.
Can i make it with python or any other language? what language? what modules?
HELP ME PLZ

sorry my bad english....


Thank you all

Offline

#2 2012-07-18 21:30:00

berbae
Member
From: France
Registered: 2007-02-12
Posts: 1,304

Re: HELP - Building a Pacman GUI - Python

Look the "Interprocess Communication and Networking" chapter 17 of the Python Standard Library Reference:
http://docs.python.org/py3k/library/ipc.html
Maybe what you need is using a pipe to communicate with a subprocess.

Offline

#3 2012-07-18 22:02:39

Mr.Elendig
#archlinux@freenode channel op
From: The intertubes
Registered: 2004-11-07
Posts: 4,094

Re: HELP - Building a Pacman GUI - Python

Don't call pacman, use pyalpm

Also gtk has it's own functions for calling external processes and for ipc.


Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest

Offline

Board footer

Powered by FluxBB