in pyme.core.Data fail new_from_fd function

Bug #674009 reported by Marcos Riosaildo
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
pyme (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Description: Ubuntu 10.04.1 LTS
Release: 10.04

python-pyme:
  Instalados: 0.8.1+clean-3
  Candidato: 0.8.1+clean-3
  Tabla de versión:
 *** 0.8.1+clean-3 0
        500 http://es.archive.ubuntu.com/ubuntu/ lucid/universe Packages
        100 /var/lib/dpkg/status

My code:
fd=open('some_file.asc', 'w+')
cipher = core.Data(file=fd)

Error:
  File "gpg.py", line 9, in <module>
    cipher = core.Data(file=fd)
  File "/usr/lib/python2.6/dist-packages/pyme/core.py", line 291, in __init__
    self.new_from_fd(file)
  File "/usr/lib/python2.6/dist-packages/pyme/core.py", line 370, in new_from_fd
    errorcheck(gpgme_data_new_from_fd(tmp, fd))
NameError: global name 'gpgme_data_new_from_fd' is not defined

If i modify the line 370 with errorcheck(pygpgme.gpgme_data_new_from_fd(tmp, fd)). The python throw other error:
Traceback (most recent call last):
  File "gpg.py", line 9, in <module>
    cipher = core.Data(file=fd)
  File "/usr/lib/python2.6/dist-packages/pyme/core.py", line 291, in __init__
    self.new_from_fd(file)
  File "/usr/lib/python2.6/dist-packages/pyme/core.py", line 370, in new_from_fd
    errorcheck(pygpgme.gpgme_data_new_from_fd(tmp, fp))
  File "/usr/lib/python2.6/dist-packages/pyme/pygpgme.py", line 862, in gpgme_data_new_from_fd
    return _pygpgme.gpgme_data_new_from_fd(*args)
TypeError: in method 'gpgme_data_new_from_fd', argument 2 of type 'int'

Proposed patch:

--- core.py 2009-11-10 15:06:18.000000000 +0100
+++ /tmp/core.py 2010-11-11 14:23:22.947568330 +0100
@@ -363,11 +363,7 @@
         call and the mode attribute."""

         tmp = pygpgme.new_gpgme_data_t_p()
- fp = pygpgme.fdopen(file.fileno(), file.mode)
- if fp == None:
- raise ValueError, "Failed to open file from %s arg %s" % \
- (str(type(file)), str(file))
- errorcheck(gpgme_data_new_from_fd(tmp, fp))
+ errorcheck(pygpgme.gpgme_data_new_from_fd(tmp, file.fileno()))
         self.wrapped = pygpgme.gpgme_data_t_p_value(tmp)
         pygpgme.delete_gpgme_data_t_p(tmp)

Revision history for this message
Stefano Rivera (stefanor) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. The issue you are reporting is an upstream one and it would be nice if somebody having it could send the bug to the developers of the software at http://sourceforge.net/projects/pyme/

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in pyme (Ubuntu):
status: New → Confirmed
Revision history for this message
Ch. Tronche (ch-tronche) wrote :

Still present in precise pangolin (12.04.1)

Revision history for this message
Ch. Tronche (ch-tronche) wrote :

Reported on the upstream bug page.

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.