By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,034 Members | 2,000 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,034 IT Pros & Developers. It's quick & easy.

regarding popen function

P: n/a

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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.