473,387 Members | 1,771 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Confusion with os.popen os.spawnl and dvbstream

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

Jul 18 '05 #1
0 1177

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: nushin | last post by:
Greetings, I am running RedHat 7.3 and trying to spawn a hello.py program from hello_driver.py by using spawn*( ) API, as a P_NOWAIT : os.spawnv(os.P_NOWAIT,'/usr/bin/python',('python hello.py...
3
by: nushin | last post by:
Try to launch a test program that prints hello world for a minute or so using, spawnv( ) or spawnl( ). Check to see the process state code that the program is running. I am using RedHat Linux 7.3...
2
by: Stuart McGraw | last post by:
When I run (Python 2.3.3) this script on a MS Windows 2000 machine: import os print "1st popen..." f = os.popen ("echo " + u"\u0054\u0045\u0053\u0054.txt") print f.read () print "2nd popen..."...
10
by: Nick Craig-Wood | last post by:
I'm trying to avoid using shell metacharacters in os.popen in a portable fashion. os.popen() only seems to take a string as the command which would need tricky quoting. os.popen2() can take a...
6
by: Salvatore | last post by:
Hello, Does someone already had ths problem ? >>> os.spawnl(os.P_NOWAIT,'c:\windows\notepad.exe') Traceback (most recent call last): File "<stdin>", line 1, in ? File...
5
by: Cameron Laird | last post by:
Question: import subprocess, StringIO input = StringIO.StringIO("abcdefgh\nabc\n") # I don't know of a compact, evocative, and # cross-platform way to exhibit this behavior. # For now, depend...
12
by: naima.mans | last post by:
hello, I run a python cgi script under Apache... and while the script is running i want to display a "please wait" message until the script finish. I have tried to do this but the "please...
3
by: Jesse | last post by:
Hi all, I have a problem using wget and Popen. I hope someone can help. -- Problem -- I want to use the command: wget -nv -O "dir/cpan.txt" "http://search.cpan.org" and capture all it's...
25
by: Jeremy Banks | last post by:
Hi. I wondered if anyone knew the rationale behind the naming of the Popen class in the subprocess module. Popen sounds like the a suitable name for a function that created a subprocess, but the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.