473,395 Members | 1,689 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

executing system calls

Python Newbie running Mandriva Linux.

I want to do a system call from a python program. Mandriva has a package manager command called urpmi. If I wanted it to install a rpm I would say on the command line "urpmi rpmname". How can execute this command from my python program?

I found 'subprocess' in the python docs, imported it into IDLE, but I can't seem to make it's example work.

So, if I wanted to do the "urpmi rpmname" command or "urpmi --auto-update" which would update my system, what should the python statement look like in my python code?

Thanks!
Mar 25 '08 #1
1 1169
Laharl
849 Expert 512MB
Use os.system(). It takes a string input that is the same thing you would normally type on the command line to do something, for example, to do ls,
Expand|Select|Wrap|Line Numbers
  1. import os
  2. os.system('ls')
  3.  
If those commands require root, as their equivalents do under Ubuntu, there's a bit more work needed, but it's still doable. I think.
Mar 25 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: tshad | last post by:
I thought I understood how the SaveViewState is working and was trying to use this (as per some code I found) to detect refreshes. It seemed to be working but I found that the SaveViewState was...
1
by: swatibksh | last post by:
i need to execute system calls of windows on remote machine in a LAN. how can i do so using java ?
1
by: swatibksh | last post by:
Hi I didn't exactly get how to execute system calls on "remote " machine on windows. For e.g. how can i run system file for getting the list of running processes on a...
1
by: Chrace | last post by:
Hi all, I have a problem with with Thread.Join( Timeout ) where the timeout never occurs. I basically need to make a connection to an AS400 box which works fine. Once in a blue moon the AS400...
4
by: K Viltersten | last post by:
I want to execute a BAT-file as follows. string dir = "c:\\temp\\"; string file = "batch.bat"; TheYetUnknownMethod(dir + file); In Perl, for instance, i can call system() with that string....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...
0
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...

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.