Public bug reported:

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)

** Affects: pyme (Ubuntu)
     Importance: Undecided
         Status: New

-- 
in pyme.core.Data fail new_from_fd function
https://bugs.launchpad.net/bugs/674009
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to