Path: csiph.com!goblin2!goblin.stu.neva.ru!aioe.org!bofh.it!news.nic.it!robomod From: Andrey Rahmatullin Newsgroups: linux.debian.bugs.dist,linux.debian.maint.python Subject: Bug#937262: Help needed (Was: pdb2pqr: Python2 removal in sid/bullseye) Date: Fri, 13 Dec 2019 22:40:01 +0100 Message-ID: References: X-Original-To: Andreas Tille X-Mailbox-Line: From debian-bugs-dist-request@lists.debian.org Fri Dec 13 21:36:10 2019 Old-Return-Path: X-Spam-Flag: NO X-Spam-Score: -4 Reply-To: Andrey Rahmatullin , 937262@bugs.debian.org Resent-To: debian-bugs-dist@lists.debian.org Resent-Cc: Debian Med Packaging Team X-Debian-Pr-Message: followup 937262 X-Debian-Pr-Package: src:pdb2pqr X-Debian-Pr-Keywords: sid help bullseye X-Debian-Pr-Source: pdb2pqr X-Spam-Bayes: score:0.0000 Tokens: new, 32; hammy, 150; neutral, 71; spammy, 0. spammytokens: hammytokens:0.000-+--H*ct:application, 0.000-+--H*ct:protocol, 0.000-+--H*ct:micalg, 0.000-+--H*ct:signed, 0.000-+--H*ct:pgp-signature Dkim-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=wrar.name; s=20160710; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=wU4mGlNATDxdkCkiKbFm/ClXAoNc4OD7nWNMmIvJ2q8=; b=h0iu0sLvoYr65BsB4wSaeCUwZ HuZPIhQEf7SxXwhHBaGYVtEZXuee7WIvXtu5YvJF8ZZDxx9aeq8nW0iRtkoQk91FvBvuc+O9UE2fh 8t+pR8pa3pTVAPcwQ1rToyKQe9dJghCV5gBbJIRVMdD0MklK2XAyI10cPlkfC9krynGFw=; MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="2hMgfIw2X+zgXrFs" Content-Disposition: inline User-Agent: Mutt/1.12.2 (2019-09-21) X-Debian-Message: from BTS X-Mailing-List: archive/latest/1573696 List-ID: List-URL: Approved: robomod@news.nic.it Lines: 77 Organization: linux.* mail to news gateway Sender: robomod@news.nic.it X-Original-Cc: 937262@bugs.debian.org, Debian Python X-Original-Date: Sat, 14 Dec 2019 02:34:28 +0500 X-Original-Message-ID: <20191213213428.GE2390860@belkar.wrar.name> X-Original-References: <20191213084947.GQ26401@an3as.eu> <20191213121845.GB2390860@belkar.wrar.name> <20191213124034.GU26401@an3as.eu> <20191213124642.GC2390860@belkar.wrar.name> <20191213141632.GX26401@an3as.eu> <20191213144922.GB4183@an3as.eu> <20191213174945.GD2390860@belkar.wrar.name> <20191213211003.GD4183@an3as.eu> <20191213211003.GD4183@an3as.eu> Xref: csiph.com linux.debian.bugs.dist:987115 linux.debian.maint.python:12147 --2hMgfIw2X+zgXrFs Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Dec 13, 2019 at 10:10:03PM +0100, Andreas Tille wrote: > i$ pdb2pqr > Traceback (most recent call last): > File "/usr/bin/pdb2pqr", line 52, in > from main import mainCommand > File "/usr/share/pdb2pqr/main.py", line 77, in > import extensions > File "/usr/share/pdb2pqr/extensions/__init__.py", line 56, in > extDict[extName] =3D __import__(extName,globals(),locals(),[], -1) > ValueError: level must be >=3D 0 """ level specifies whether to use absolute or relative imports. The default is -1 which indicates both absolute and relative imports will be attempted. 0 means only perform absolute imports. Positive values for level indicate the number of parent directories to search relative to the directory of the module calling __import__(). """ https://docs.python.org/2.7/library/functions.html#__import__ -1 was removed in 3.3 as implicit relative import are not supported in 3.x. As this code seems to use relative imports you need to change -1 to 1. > So I tried: >=20 > --- a/extensions/__init__.py > +++ b/extensions/__init__.py > @@ -53,7 +53,7 @@ _extList =3D [name for _, name, _ in pkgutil.iter_modul= es(__path__)] > extDict =3D {} > =20 > for extName in _extList: > - extDict[extName] =3D __import__(extName,globals(),locals(),[], -1) > + extDict[extName] =3D __import__(extName,globals(),locals(),[], 0)^M Mindlessly changing the code is almost always a bad idea... > File "/usr/share/pdb2pqr/extensions/__init__.py", line 57, in > extDict[extName] =3D __import__(extName,globals(),locals(),[], 0) > ModuleNotFoundError: No module named 'chi' This is expected as it now tries to do "import chi". With 1 it should try "from . import chi". This fails later, as the source also has implicit relative imports that needs to be fixed, for example "from aconf import" in src/utilities.py. --=20 WBR, wRAR --2hMgfIw2X+zgXrFs Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJhBAABCgBLFiEEolIP6gqGcKZh3YxVM2L3AxpJkuEFAl30A+QtFIAAAAAAFQAP cGthLWFkZHJlc3NAZ251cGcub3Jnd3JhckBkZWJpYW4ub3JnAAoJEDNi9wMaSZLh /p4P/Rymy6oB3gn1wJ0/xXE4ShMMTmsNPelSJ9Etcg54J7G/jE/0u+Vh+BDvLaRP yUfv+ySsdp+UrLfgMsdlES4WMoXO5YbsB08YmXim3Fn1lsi/aZJhQiQUy2Ytd5b9 j9O8Rwsh7gGkpbgEBxKbU4xJm6poyxzZp+ciD19XX9P3QDWDilIzvOsZxjKyqqyf Plz5s0fRJg8cTo1QX43mriB77l16o6LCn0y2eYMiLnAG8CVqNr9yNbJ1OuR2Bqft 6UfkJOYqYVuSliPN1oBtHB1TH+Y3gg2hsJOg+yC6Vdnu371GAGKcfBXPS5RJyyAZ 3I9Au+J23bTzqAblkahQPRoZMsFfnEymQ60n/8aAacxFwvaJVe5uAVm24wFTgueO fld+XRqppDc067YuOcHwq2fWNtgB9hDk+bcOnm31W4VuXO18B8Cxx7o0+sU/Ug6M u80kjhvI9GXXmzwdG0bA6mao/6/Xx05H5UVnoNoo8s58YemR12/DR8gY7eyoR7CX +yTTeeMWNlXra6eqGdyic7Xj1Vo+IF9YKCgkJJX353rN/Y+eTBKQmmn0NyIupHLT E4CWgLDLhVQbHcSYg1ha2WFoCRDFX6BE6CQmt5SSVKeBBSqQNxsmBHQVjxxkc6vx SU8rgP2LGl53bp9ueqsnOuPiF5MefR+VsNS8jnOZLDpu0IRA =FnjS -----END PGP SIGNATURE----- --2hMgfIw2X+zgXrFs--