Confusion with os.popen os.spawnl and dvbstream

Discussion in 'Python' started by Steve Homer, Apr 29, 2004.

  1. Steve Homer

    Steve Homer Guest

    Hi everyone,

    Appologies if this is the wrong forum for this post.

    I am a little confused by the code below and any help would be much
    appreciated.

    import os,signal,time,sys

    class Tzap:
    tzap_exe = '/usr/local/bin/tzap'

    def __init__(self, channel_string):
    self.channel = channel_string

    def SetChannel(self):
    print "Tzap.SetChannel()"
    self.channelpid = os.spawnlp(os.P_NOWAIT, self.tzap_exe,
    self.tzap_exe, self.channel)
    time.sleep(5)
    os.kill(self.channelpid, signal.SIGKILL)
    print "End Tzap.SetChannel()"

    class Record:
    dvbstream_exe = '/usr/local/bin/dvbstream'

    def __init__(self, minutes_to_record):
    self.duration = minutes_to_record

    def Record(self):
    commandline = ' -ps 600 601 -o > /Media/Movies/BBC.mpg'
    print self.dvbstream_exe, commandline

    # These are the confusing lines....

    #self.dvbstream_pid = os.popen3(self.dvbstream_exe +
    commandline)
    self.dvbstream_pid = os.spawnl(os.P_NOWAIT,
    self.dvbstream_exe, self.dvbstream_exe, commandline)

    time.sleep(self.duration * 60)

    os.kill(self.dvbstream_pid, signal.SIGKILL)


    print "start tzap"
    tzap = Tzap('BBC ONE')
    tzap.SetChannel()
    print "stop tzap"
    print "start record"
    recorder = Record(1)
    recorder.Record()

    using the popen3 function I get an mpg stream recording in BBC.mpg but
    using spawnl I get the following

    /usr/local/bin/dvbstream -ps 600 601 -o > /Media/Movies/BBC.mpg
    dvbstream v0.5 - (C) Dave Chapman 2001-2004
    Released under the GPL.
    Latest version available from http://www.linuxstb.org/
    Using 224.0.1.2:5004:2
    version=2
    Streaming 0 streams

    and no data in the file. I guess this is something to do with the
    different environment in each case, but I don't know where to start
    debugging it. Any pointers would be much appreciated.

    Thanks,
    Steve
    Steve Homer, Apr 29, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Pegboy

    spawnl() and command.com

    Pegboy, Nov 11, 2003, in forum: C Programming
    Replies:
    2
    Views:
    835
    Pegboy
    Nov 11, 2003
  2. nushin
    Replies:
    0
    Views:
    336
    nushin
    Jul 29, 2003
  3. nushin
    Replies:
    3
    Views:
    6,821
    nushin
    Aug 7, 2003
  4. Jonathan Ellis

    windows, spawnl, and sys.argv

    Jonathan Ellis, Nov 7, 2004, in forum: Python
    Replies:
    0
    Views:
    324
    Jonathan Ellis
    Nov 7, 2004
  5. spawnl and waitpid

    , Feb 27, 2007, in forum: Python
    Replies:
    13
    Views:
    764
Loading...

Share This Page