473,466 Members | 1,329 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

regarding popen function


Dear All,

The following way of popen function usage is
wrong or not kindly give me answer regarding this

time = os.popen("echo %s | tai64nlocal" %
line[2]).read()

Actually here I didn't use any file handler and
I didn't close file handler.

regards
Prabahar



__________________________________________________ ________
Free antispam, antivirus and 1GB to save all your messages
Only in Yahoo! Mail: http://in.mail.yahoo.com
Jul 19 '05 #1
2 1398
praba kar wrote:
The following way of popen function usage is
wrong or not kindly give me answer regarding this

time = os.popen("echo %s | tai64nlocal" %
line[2]).read()


I don't know, I don't know what tai64nlocal is or what's in line[2].
What happened when you tried it?

Personally I try to use the subprocess module rather than os.popen.
--
Michael Hoffman
Jul 19 '05 #2
praba kar wrote:
The following way of popen function usage is
wrong or not kindly give me answer regarding this

time = os.popen("echo %s | tai64nlocal" %
line[2]).read()


Did you try it? Just open the Python interactive interpreter and see
what happens:

Python 2.3.4 (#1, Feb 2 2005, 12:11:53)
[GCC 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)] on linux2
import os
line = ['', '', '@4000000042b40a8716ebce34']
time = os.popen('echo %s | tai64nlocal' % line[2]).read()
time

'2005-06-18 07:50:21.384552500\n'

Or were you just asking if it was an appropriate way of using
os.popen()? If that's what you were asking, it would have been much
clearer not to include the command itself, since clearly it just
confuses people about what you are asking.

Yes, it's an appropriate way to use popen(), and it does seem to work if
you have tai64nlocal in your path.

(Michael, tai64nlocal is a program that converts a special "packed"
timestamp to human-readable form. These timestamps are created, as I
recall, by the multilog program that the developer of Qmail created.)

-Peter
Jul 19 '05 #3

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

Similar topics

0
by: M | last post by:
Hi Folks, I would like to use popen and redirect output from a program, except it doesn't seem to work. I am using IIS 5.1 on Windows XP Pro. Error messages are as follows: Warning:...
2
by: Sami Viitanen | last post by:
Hello, I was using os.popen function to get CVS command output to string from script.. Same commands worked well with Windows, but Linux seems to have problem with those. Whole CVS commands...
1
by: Mosas | last post by:
Dear All, Php has exec function to run system commands and this function return last line of system command result. But in Python I can see only os.system() function to run system command but it...
3
by: Grumble | last post by:
Hello all, Is there an iostream equivalent to cstdio's popen()? Is there a way to change a FILE * into an iostream?
1
by: sam | last post by:
Hi, I try to use popen execute scp, when the user finish password, it will return to the cin input prompt, but the problem is popen does not wait for user finish typing up the password before...
4
by: agarwalpiyush | last post by:
Hello, I am going nuts with trying to get the following to work: This is what I intend to do: I have a line in /etc/syslog.conf which I need to delete based on ip-address provided to me in a...
7
by: skunkwerk | last post by:
Hi, i'm trying to call subprocess.popen on the 'rename' function in linux. When I run the command from the shell, like so: rename -vn 's/\.htm$/\.html/' *.htm it works fine... however when I...
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...
1
by: Mark Shewfelt | last post by:
Hello, I am attempting to use Popen() in a Windows service. I have a small Win32 .exe that I normally run through the os.popen2() function. I've written a class to work with the input and output...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.