[Tutor] python newbie..system call help

Mike Pindzola pindzola at charter.net
Wed Jul 13 04:15:47 CEST 2005


I have figured many things out. system works, i just forgot to type 
os.system(). I have been looking into the os module and am finding alot 
of useful stuff. I still need to workout the best way to ask a user for 
a root password, show **** when typed and then pass it to the system...

thanks for any responses

Mike Pindzola wrote:

> Yes, I have did 'import os'. For starters I want to read the result of 
> 'pwd' and print it out in the program for the user to see what path is 
> being read. Also, I need to have a function to handle root access if 
> the user does not have such privledges since I will be mounting and 
> unmounting hardware. So a call to 'su' would be in order as well as 
> sending the user provided password back to it.
>
> Aside from that, just so copying of files, making dirs, and changing 
> file permissions.
>
> jfouhy at paradise.net.nz wrote:
>
>> Quoting Mike Pindzola <pindzola at charter.net>:
>>
>>  
>>
>>> Should I be even trying to make a system call? Is there a better way to
>>> talk to the shell? Either way, please enlighten me. Thanks.
>>>   
>>
>>
>> There may be a better way to achieve what you want to do, without 
>> using the
>> shell at all.  For example, the os and os.path modules include a 
>> range of
>> functions for manipulating files and directories (listing, walking, 
>> moving,
>> renaming, et cetera).  Perhaps, if you say what you are trying to 
>> achieve, we
>> can give some pointers.
>>
>>  
>>
>


More information about the Tutor mailing list