![]() |
Re: Partition names with Python
On Tue, Jul 01, 2003 at 02:45:15AM +0000, Bengt Richter wrote:
> > You might want to try something like > > import os > print os.popen('mount').read() Or simply reading /etc/mtab or perhaps /proc/mounts (this one is linux-specific, I think), rather than spawning a process. -Andrew. |
Re: Partition names with Python
In the darkest hour on Tue, 1 Jul 2003 18:25:46 +1000,
Andrew Bennetts <andrew-pythonlist@puzzling.org> screamed: >> You might want to try something like >> >> import os >> print os.popen('mount').read() > > Or simply reading /etc/mtab or perhaps /proc/mounts (this one is > linux-specific, I think), rather than spawning a process. > And /proc/partitions. Artur -- Before the Goat of Mendes... we all must take our turn | Artur M. Piwko Into the magic circle... where still the fire burns | mailto:s/_/./ We're spinning round and round... until one takes a fall | -- Mercyful Fate The fallen one will not return, the fallen one must burn | "Witches' Dance" |
Re: Partition names with Python
>>>>> "Artur" == Artur M Piwko <pipen@beast_tu_kielce.pl> writes:
Artur> And /proc/partitions. Best yet! import os fh = file('/proc/partitions') fh.readline() # eat the header fh.readline() # eat the blank line partitions = [line.split()[-1] for line in fh.readlines()] print partitions |
Re: Partition names with Python
Hi,
But some machines /proc/partition file is empty.. But /etc/fstab contain drives names..(sda1,sda2,cdrom,floopy etc) For Example My Server(Slackware 9)'s /proc/partition file contain nothing. I must take partition names on all Linux(Redhat,Mandrake,Slackware etc).. Why do some machine's /proc/partition file contain nothing... Erhan, Quoting John Hunter <jdhunter@ace.bsd.uchicago.edu>: > >>>>> "Artur" == Artur M Piwko <pipen@beast_tu_kielce.pl> writes: > > Artur> And /proc/partitions. > > Best yet! > > import os > fh = file('/proc/partitions') > > fh.readline() # eat the header > fh.readline() # eat the blank line > > partitions = [line.split()[-1] for line in fh.readlines()] > print partitions > > -- > http://mail.python.org/mailman/listinfo/python-list > -- Erhan Ekici ITU Center for Distance Learning E-Mail : erhan@uzem.itu.edu.tr |
Re: Partition names with Python
In the darkest hour on Wed, 2 Jul 2003 11:17:49 +0300,
Erhan Ekici <erhan@uzem.itu.edu.tr> screamed: > But some machines /proc/partition file is empty.. > But /etc/fstab contain drives names..(sda1,sda2,cdrom,floopy etc) > > For Example My Server(Slackware 9)'s /proc/partition file contain nothing. > I must take partition names on all Linux(Redhat,Mandrake,Slackware etc).. > > Why do some machine's /proc/partition file contain nothing... > Yes, you have to compile it to kernel. The best choice is /etc/mtab, imho. Artur -- Before the Goat of Mendes... we all must take our turn | Artur M. Piwko Into the magic circle... where still the fire burns | mailto:s/_/./ We're spinning round and round... until one takes a fall | -- Mercyful Fate The fallen one will not return, the fallen one must burn | "Witches' Dance" |
| All times are GMT. The time now is 09:37 AM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.