Your message dated Thu, 12 Dec 2019 01:49:14 +0000
with message-id <[email protected]>
and subject line Bug#945391: fixed in asciidoc 9.0.0~rc1-1
has caused the Debian Bug report #945391,
regarding asciidocapi: fails with AttributeError: 'NoneType' object has no 
attribute 'loader'
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
945391: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=945391
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: asciidoc
Version: 8.6.10+git20190307.51d7c14-1
Severity: normal
Tags: patch

Hello,

using asciidocapi with the following small script (also attached)

    #!/usr/bin/python3

    import io
    import sys

    sys.path.append('/usr/share/asciidoc')
    import asciidocapi


    infile = io.StringIO('Test')
    outfile = io.StringIO()

    adoc = asciidocapi.AsciiDocAPI()
    adoc.execute(infile, outfile)

results in an exception:

    Traceback (most recent call last):
    File "./test", line 13, in <module>
        adoc = asciidocapi.AsciiDocAPI()
    File "/usr/share/asciidoc/asciidocapi.py", line 209, in __init__
        self.__import_asciidoc()
    File "/usr/share/asciidoc/asciidocapi.py", line 244, in __import_asciidoc
        module = importlib.util.module_from_spec(spec)
    File "<frozen importlib._bootstrap>", line 580, in module_from_spec
    AttributeError: 'NoneType' object has no attribute 'loader'

The attached patch fixes this issue (tested with python3.7 and
python3.8).

Regards
Simon
-- 
+ privacy is necessary
+ using gnupg http://gnupg.org
+ public key id: 0x92FEFDB7E44C32F9
#!/usr/bin/python3

import io
import sys

sys.path.append('/usr/share/asciidoc')
import asciidocapi


infile = io.StringIO('Test')
outfile = io.StringIO()

adoc = asciidocapi.AsciiDocAPI()
adoc.execute(infile, outfile)
--- /usr/share/asciidoc/asciidocapi.py.orig	2019-11-19 08:27:07.987333977 +0100
+++ /usr/share/asciidoc/asciidocapi.py	2019-11-24 08:23:19.141730508 +0100
@@ -239,9 +239,13 @@
                     import imp
                     module = imp.load_source('asciidoc', self.cmd)
                 else:
-                    import importlib.util
-                    spec = importlib.util.spec_from_file_location('asciidoc', self.cmd)
-                    module = importlib.util.module_from_spec(spec)
+                    # Thanks to Mad Physicist for this solution, read on 2019-11-19
+                    # https://stackoverflow.com/questions/2601047/import-a-python-module-without-the-py-extension/43602645#43602645
+                    from importlib.util import spec_from_loader, module_from_spec
+                    from importlib.machinery import SourceFileLoader
+                    loader = SourceFileLoader('asciidoc', self.cmd)
+                    spec = spec_from_loader('asciidoc', loader)
+                    module = module_from_spec(spec)
                     spec.loader.exec_module(module)
                 self.asciidoc = module
             except ImportError:

Attachment: signature.asc
Description: PGP signature


--- End Message ---
--- Begin Message ---
Source: asciidoc
Source-Version: 9.0.0~rc1-1

We believe that the bug you reported is fixed in the latest version of
asciidoc, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Joseph Herlant <[email protected]> (supplier of updated asciidoc package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Format: 1.8
Date: Wed, 11 Dec 2019 16:26:21 -0800
Source: asciidoc
Architecture: source
Version: 9.0.0~rc1-1
Distribution: unstable
Urgency: medium
Maintainer: Joseph Herlant <[email protected]>
Changed-By: Joseph Herlant <[email protected]>
Closes: 945391
Changes:
 asciidoc (9.0.0~rc1-1) unstable; urgency=medium
 .
   * New upstream version 9.0.0rc1 (Closes: #945391)
   * Refresh patches and remove patch integrated in the release
   * d/control:
     * bump standards to 4.4.1
     * fix typo in package description
     * adding an explicit Rules-Requires-Root field
   * d/gbp.conf: move to deb14 branch naming for debian branch
Checksums-Sha1:
 fac82286357bf992bd7abac275a3e6fd28197a26 2356 asciidoc_9.0.0~rc1-1.dsc
 1ed638321514f360fb6e841148a7f398de2cccf2 1266517 asciidoc_9.0.0~rc1.orig.tar.gz
 51ae4d2bc7f8464c2cd6109f7140652473be19f1 13232 
asciidoc_9.0.0~rc1-1.debian.tar.xz
 66a2e792ef344567ffc778850321567d7063fe1f 5732 
asciidoc_9.0.0~rc1-1_source.buildinfo
Checksums-Sha256:
 61d1317008c376bc82148772504cfb49dfd67cd8942ae46f17633a5a7d89c2f3 2356 
asciidoc_9.0.0~rc1-1.dsc
 004fc2c72159ab2ffee69927c252721423786abbb072848e08383b4376c1e9c9 1266517 
asciidoc_9.0.0~rc1.orig.tar.gz
 4bad668a8d01b3c7d3c82f807518f116339535aba3299e2500d88aff8ffa54bb 13232 
asciidoc_9.0.0~rc1-1.debian.tar.xz
 ea361b7a6e7d2327d6343fba0b0a1eff9c0878ae28877d6998d1713dc5fb4e38 5732 
asciidoc_9.0.0~rc1-1_source.buildinfo
Files:
 1e81f81a5be67b9af8ad5a9c87c68d3e 2356 text optional asciidoc_9.0.0~rc1-1.dsc
 2dfd0dd4826b95afb35e5a037df1c570 1266517 text optional 
asciidoc_9.0.0~rc1.orig.tar.gz
 e2524711e2a2bec9a5221a676012080d 13232 text optional 
asciidoc_9.0.0~rc1-1.debian.tar.xz
 b1ad69103a22d0ff2c8f28972f6ebb25 5732 text optional 
asciidoc_9.0.0~rc1-1_source.buildinfo

-----BEGIN PGP SIGNATURE-----

iQJKBAEBCgA0FiEE6CPaER4i14V+HYZYY/eACiPXslIFAl3xmGMWHGFlcm9zdGl0
Y2hAZGViaWFuLm9yZwAKCRBj94AKI9eyUgObD/0ahQUl8yAKa6vV8alBNNHQ+WxN
6X10NmIJC7GadSaHQ8Eq3BeIAcw6ER9tFvs3KjP84qUtOKOb2RlBQg8Wwmv0kcQ3
XaN4nMExkGq+LbCm8NmqgLPD90J7SSI7ZnmQnticVNN1oBBtJYYAMd+bOQHszWuc
wd0Iw3BX1Em98cXjYOhkneSZrtVG+GU+UbtiKpR6wC1rhW1KTHke0sv0U2SxVNwD
f1P1v0Hp53OEc7dB/B156IlzIRDidj1qeLlypALthmFLZkxhlXg3bPHho4mrpPuC
nA6OoXlxfBeEaVQ/Ml2esaHnW33lnWW+Z87ZgGTPyyRbYd7Mo5aqC3DekHsEeKw+
gJLHT7TSj1wB24iaoLXdVVc/hX1FSMhTHEXX+7EgR+Yk93yBfeJpfnBRHAEjI5ow
0BFWTfDoUYK3r56897ffoWb2JIElx7Sq7Z7T+3BCc0FlLqxj9GdbNWc81DdQNqb2
GvzawoHkUV7md+fqACSoa+BKHrNfhBBMkCQH3wn6FlkTRzxMnw0nLIOgmApX9K1m
Y2XPUgsA0tjq+1U2KB6gPZp6QKQ1boHCze157fhlXu1gha9J4j/proY7RN52ldSu
L72dr5yFmBcd/30QRkKEh+P/TNI290Gfh3ue/d0+HyZdwspPP9ed9WewuBwGHipm
eQky3uJ2AZH09AEiiQ==
=WgX4
-----END PGP SIGNATURE-----

--- End Message ---

Reply via email to