raise ValueError:" Invalid flag provided." when import parted module in pyhon

Bug #669931 reported by Hsin-Yi, Chen (hychen)
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OEM Priority Project
Fix Released
Medium
Unassigned
Python
Invalid
Undecided
Unassigned
pyparted (Ubuntu)
Fix Released
Undecided
Unassigned
Maverick
Fix Released
Undecided
Unassigned

Bug Description

During Maverick's development cycle, pyparted and parted in Ubuntu got out of sync. pyparted added a new constant that parted didn't yet have, so we dropped that constant.

Later in the development cycle, the constant was added back. parted's awareness of this constant and pyparted's lack of awareness results in an exception being raised immediately when you attempt to import the parted module.

IMPACT: The python-parted package is unusable, because the parted module can not be imported

DEVELOPMENT: The bug was fixed in Natty by undoing the change in version 3.4-2ubuntu1 (i.e. 3.4-2ubuntu2 is the same as 3.4-2, except for changelog entries)

PATCH: Attached at <http://launchpadlibrarian.net/59071487/pyparted_3.4-2ubuntu1.1.debdiff>. This is identical to the patch uploaded for Natty, with the exception of the version number

REPRODUCTION: Run "import parted" at a Python prompt:

Python 2.6.6 (r266:84292, Sep 15 2010, 15:52:39)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import parted
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/pymodules/python2.6/parted/__init__.py", line 53, in <module>
    from partition import Partition
  File "/usr/lib/pymodules/python2.6/parted/partition.py", line 249, in <module>
    partitionFlag[__flag] = _ped.partition_flag_get_name(__flag)
ValueError: Invalid flag provided.

REGRESSION: Minimal risk. Can't do much worse than an un-importable module.

====
Original description (changed by broder):

Ubuntu Version: Maverick
Arch: i386
Summery:

According changelog, no_PED_PARTITION_DIAG.patch is for parted 2.2, but in Maverick, the parted is 2.3.

Packages:

ii libparted0debian1 2.3-2ubuntu1 The GNU Parted disk partitioning shared library
ii parted 2.3-2ubuntu1 The GNU Parted disk partition resizing program
ii python-parted 3.4-2ubuntu1 Python interface for libparted

Step to reproduce:

Python 2.6.6 (r266:84292, Sep 15 2010, 15:52:39)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import parted
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/pymodules/python2.6/parted/__init__.py", line 53, in <module>
    from partition import Partition
  File "/usr/lib/pymodules/python2.6/parted/partition.py", line 249, in <module>
    partitionFlag[__flag] = _ped.partition_flag_get_name(__flag)
ValueError: Invalid flag provided.

Test:

python-parted package from Debian archive works in Maverick

Revision history for this message
braulioareis (braulioareis) wrote :

tested

Changed in pyparted (Ubuntu):
status: New → Opinion
assignee: nobody → braulioareis (braulioareis)
Revision history for this message
Hsin-Yi, Chen (hychen) (ossug-hychen) wrote :

@braulioareis Are you working on this bug?

Revision history for this message
Hsin-Yi, Chen (hychen) (ossug-hychen) wrote :

This is a bug report not just a opinion which does not list in bug list

Changed in pyparted (Ubuntu):
status: Opinion → New
Changed in python:
assignee: nobody → braulioareis (braulioareis)
status: New → Opinion
Changed in python:
assignee: braulioareis (braulioareis) → nobody
status: Opinion → New
Changed in pyparted (Ubuntu):
assignee: braulioareis (braulioareis) → nobody
Evan Broder (broder)
Changed in pyparted (Ubuntu):
status: New → Confirmed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package pyparted - 3.4-2ubuntu2

---------------
pyparted (3.4-2ubuntu2) natty; urgency=low

  * debian/patches/no_PED_PARTITION_DIAG.patch:
    - Removed, again. Ubuntu has parted 2.3 (LP: #669931)
  * debian/control:
    - Bump parted build-dep back to 2.3
 -- Evan Broder <email address hidden> Fri, 12 Nov 2010 22:03:13 -0800

Changed in pyparted (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
Evan Broder (broder) wrote :

Here's a copy of the patch I'm uploading for a Maverick SRU. (It's identical to the patch I uploaded for Natty, with the exception of changelog information)

Revision history for this message
Evan Broder (broder) wrote :

Sorry, grabbed the wrong file. *This* is the patch I'm uploading for the Maverick SRU.

description: updated
Steve Magoun (smagoun)
Changed in oem-priority:
status: New → Triaged
importance: Undecided → Medium
Revision history for this message
Martin Pitt (pitti) wrote : Please test proposed package

Accepted pyparted into maverick-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

Changed in pyparted (Ubuntu Maverick):
status: New → Fix Committed
tags: added: verification-needed
Revision history for this message
Evan Broder (broder) wrote :

Using the package in maverick-proposed, I was able to import the parted module and perform basic queries about my disk. Looks good:

ebroder@tracey:~$ sudo python
Python 2.6.6 (r266:84292, Sep 15 2010, 16:22:56)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import parted
>>> dev = parted.getDevice('/dev/sda')
>>> print dev
parted.Device instance --
  model: ATA ST9250410AS path: /dev/sda type: 1
  sectorSize: 512 physicalSectorSize: 512
  length: 488397168 openCount: 0 readOnly: False
  externalMode: False dirty: False bootDirty: False
  host: 1 did: 0 busy: True
  hardwareGeometry: (30401, 255, 63) biosGeometry: (30401, 255, 63)
  PedDevice: <_ped.Device object at 0x7f5f9afeb440>
>>> disk = parted.Disk(dev)
>>> print disk
parted.Disk instance --
  type: msdos primaryPartitionCount: 2
  lastPartitionNumber: 5 maxPrimaryPartitionCount: 4
  partitions: [<parted.partition.Partition object at 0x7f5f9b00a050>, <parted.partition.Partition object at 0x7f5f9b00a390>, <parted.partition.Partition object at 0x7f5f9b00a510>]
  device: <parted.device.Device object at 0x7f5f9b000b50>
  PedDisk: <_ped.Disk object at 0x7f5f9b0ab5f0>
>>> print disk.partitions[0]
parted.Partition instance --
  disk: <parted.disk.Disk object at 0x7f5f9b000e10> fileSystem: <parted.filesystem.FileSystem object at 0x7f5f9b00a290>
  number: 1 path: /dev/sda1 type: 0
  name: None active: True busy: True
  geometry: <parted.geometry.Geometry object at 0x7f5f9b00a090> PedPartition: <_ped.Partition object at 0x7f5f9aff4d70>
>>>

tags: added: verification-done
removed: verification-needed
Revision history for this message
Hsin-Yi, Chen (hychen) (ossug-hychen) wrote :

I can also confirm python-parted (3.4-2ubuntu1.1) in maverick-proposed works

Martin Pitt (pitti)
Changed in python:
status: New → Invalid
Changed in oem-priority:
status: Triaged → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package pyparted - 3.4-2ubuntu1.1

---------------
pyparted (3.4-2ubuntu1.1) maverick-proposed; urgency=low

  * debian/patches/no_PED_PARTITION_DIAG.patch:
    - Removed, again. Ubuntu has parted 2.3 (LP: #669931)
  * debian/control:
    - Bump parted build-dep back to 2.3
 -- Evan Broder <email address hidden> Fri, 12 Nov 2010 22:03:13 -0800

Changed in pyparted (Ubuntu Maverick):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.