Python to call commands, e.g. "find , perl scripts , nmap , and others" is this possible?

Emile van Sebille emile at fenx.com
Thu Jun 1 21:17:27 EDT 2000


Ken,

Are you trying this in IDLE?  I get the same error there.  
If so, try starting python from within a dos window and
see if that makes a difference.  Pipes in winxx are somewhat 
flakey as I understand.

Emile van Sebille
emile at fenx.com
-------------------


----- Original Message ----- 
From: Ken Seehof 
To: Emile van Sebille 
Cc: python-list at python.org 
Sent: Thursday, June 01, 2000 5:25 PM
Subject: Re: Python to call commands, e.g. "find , perl scripts , nmap , and others" is this possible?


On NT I get: 
>>> mylist = os.popen('dir').readlines() 
Traceback (innermost last): 
  File "<interactive input>", line 1, in ? 
OSError: (0, 'Error') 

(same thing with any command) 

popen (command[, mode[, bufsize]]) 
    Open a pipe to or from command. The return value is an open 
    file object connected to the pipe, which can be read or written 
    depending on whether mode is 'r' (default) or 'w'. The bufsize 
    argument has the same meaning as the corresponding argument 
    to the built-in open() function. The exit status of the command 
    (encoded in the format specified for wait()) is available as the 
    return value of the close() method of the file object, except that 
    when the exit status is zero (termination without errors), None is 
    returned. Availability: Unix, Windows. 

- Ken Seehof 

Emile van Sebille wrote: 

  Jim, Take a look at os.popen, as in: import osmylist = os.popen('locate myname').readlines()for eachfile in mylist: do something with eachfile HTH,  
  Emile van Sebille 
  emile at fenx.com 
  -------------------   
  ----- Original Message ----- 
  From: Jim
  To: python-list at python.orgSent: Thursday, June 01, 2000 9:44 AMSubject: Python to call commands, e.g. "find , perl scripts , nmap , and others" is this possible?
    
  Dear list, 

  I'm new to Python, and I'm sorry if I'm asking about anything that has been 
  already discussed. 

  I would like to use Python to call commands, e.g. "find , perl scripts  , nmap , and others" is this possible? 

  I do not need GUI. All I need is to link the out put and work with it. Is perl or shell scripts my only 
  answer? 

  jim 

-- 
Proprietary & Confidential.  The information transmitted is intended only for the person or entity to whom it is addressed and may
contain confidential and/or privileged material.  Any review, retransmission, dissemination, or other use of, or taking of any
action in reliance upon, this information by persons or entities other than the intended recipient is prohibited.  If you received this in error, please
contact the sender and delete the material from any computer.
   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20000601/b2d8d4e6/attachment.html>


More information about the Python-list mailing list