[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

problems with python-parted and the creation of partitions

From: Ignacio N Feijoo
Subject: problems with python-parted and the creation of partitions
Date: Mon, 13 Sep 2004 23:37:40 +0000
User-agent: Mozilla Thunderbird 0.5 (X11/20040306)

Hello, I am new in the list and, before nothing, I must clarify that I read (or that treats) all scripts on the subject that there is in the list. I am practically new with python, but I program long ago and it accustoms to me quickly to the language, but, me complica a little some functions and some documentation. The subject is that I must arm a particionador in python with parted (I have, I am forced). I already have finished to all the front-end (dialog) and the program this in conditions for showing to information on discs and the partitions. But it costs to me to create partitions.

I show script to them that I made to prove:

Ignacio:~/particionador/# cat test.py
#!/usr/bin/env python

import parted, sys

path = '/dev/hdc'

drv = parted.device_get(path)
disk = drv.disk_open()

part = []
for i in disk.get_part_list():
     if i.get_num() <> -1:

fs = parted.file_system_type_get('ext2')

start = part[1].get_geom().get_end() + 1
size = start + 1000

Part = parted.Partition(disk,type,fs,start,size)

if not Part:
     print "no se puede crear particion"

if Part.get_num() == -1:
     print "particion fork?"

if disk.add_partition(Part) == 0:
     print "nos e puede agregar la particion"
     print "Partition %s%d create!!" % (path,Part.get_num())
Ignacio:~/particionador/# ./test.py
Partition fork?

This code, or generates a partition to me fork or it creates a normal partition to me, but when trying to do add, it throws a segment violation to me. I am trying long ago to create a partition and it does not leave. But, when it tries to redimencionar a partition! Somebody can help me? somebody has script that does this and that him can throw a look?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]