RPM error

Steven Howe howe.steven at gmail.com
Tue Apr 24 14:20:28 EDT 2007


CSUIDL PROGRAMMEr wrote:
> Hi folks
> I am new to python
> I am trying to write a program that will install rpm
> using rpm -ivh xxx.rpm
>
> I want to know if python has in-built exceptions  to catch no-
> dependencies error.
>
> If not how can i build them
>
> thanks
>
>   
not really sure where your going with this... but
you could use popen3 to redirect the StdError and StdOut of rpm to 
files. Then read those
files (in particular StdError) for dependency output

*popen3*( 	cmd[, mode[, bufsize]])

    Executes cmd as a sub-process. Returns the file objects
    |(child_stdin, child_stdout, child_stderr)|. Availability:
    Macintosh, Unix, Windows. New in version 2.0. 
if your app doesn't wnat to wait, you can use os.spawn functions

*P_NOWAIT*

*P_NOWAITO*
    Possible values for the mode parameter to the spawn*() family of
    functions. If either of these values is given, the spawn*()
    functions will return as soon as the new process has been created,
    with the process ID as the return value. Availability: Macintosh,
    Unix, Windows. New in version 1.6. 

*P_WAIT*
    Possible value for the mode parameter to the spawn*() family of
    functions. If this is given as mode, the spawn*() functions will not
    return until the new process has run to completion and will return
    the exit code of the process the run is successful, or |-signal| if
    a signal kills the process. Availability: Macintosh, Unix, Windows.
    New in version 1.6. 

sph





More information about the Python-list mailing list