473,574 Members | 2,450 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.SetChanne l()"
self.channelpid = os.spawnlp(os.P _NOWAIT, self.tzap_exe,
self.tzap_exe, self.channel)
time.sleep(5)
os.kill(self.ch annelpid, signal.SIGKILL)
print "End Tzap.SetChannel ()"

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

def __init__(self, minutes_to_reco rd):
self.duration = minutes_to_reco rd

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.dv bstream_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 1179

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

Similar topics

0
1661
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 >/dev/null &')) and when i check the process state code of hello.py by: ps -aux
3
10806
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 and Python 2.2.2 and i see that the program is either launched as Zombie state using spawnv(), or running in State "S" sleep in spawnl( ). Here's...
2
4308
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..." f = os.popen ("echo " + u"\u5927\u7530\u8061\u7f8e.txt") print f.read ()
10
2872
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 string or a list - the relevant code in Unix python (in popen2.py) being... def _run_child(self, cmd):
6
5534
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 "C:\Python24\lib\os.py", line 565, in spawnl return spawnv(mode, file, args) OSError: Invalid argument
5
8631
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 on cat(1). p = subprocess.Popen(, stdout = subprocess.PIPE, stdin = response)
12
2870
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 wait" message appears at the script end (which is useless at this time! )
3
7787
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 stdout+stderr. (Note that option -O requires 'dir' to be existing before wget is executed) Popen doesn't work, while os.system and shell do. Popen will...
25
2757
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 object itself is a subprocess, not a "popen". It seems that it would be more accurate to just name the class Subprocess, can anyone explain why this...
0
7794
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7710
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8040
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8092
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5610
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3738
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2230
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1332
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1051
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.