Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.maint.python > #12147
| From | Andrey Rahmatullin <wrar@debian.org> |
|---|---|
| Newsgroups | linux.debian.bugs.dist, linux.debian.maint.python |
| Subject | Bug#937262: Help needed (Was: pdb2pqr: Python2 removal in sid/bullseye) |
| Date | 2019-12-13 22:40 +0100 |
| Message-ID | <zd0Pf-19a-5@gated-at.bofh.it> (permalink) |
| References | (7 earlier) <zcUqu-5DB-5@gated-at.bofh.it> <zcXol-7oT-1@gated-at.bofh.it> <zd0vU-121-9@gated-at.bofh.it> <zczm1-12V-7@gated-at.bofh.it> <zd0vU-121-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Cross-posted to 2 groups.
[Multipart message — attachments visible in raw view] - view raw
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 <module>
> from main import mainCommand
> File "/usr/share/pdb2pqr/main.py", line 77, in <module>
> import extensions
> File "/usr/share/pdb2pqr/extensions/__init__.py", line 56, in <module>
> extDict[extName] = __import__(extName,globals(),locals(),[], -1)
> ValueError: level must be >= 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:
>
> --- a/extensions/__init__.py
> +++ b/extensions/__init__.py
> @@ -53,7 +53,7 @@ _extList = [name for _, name, _ in pkgutil.iter_modules(__path__)]
> extDict = {}
>
> for extName in _extList:
> - extDict[extName] = __import__(extName,globals(),locals(),[], -1)
> + extDict[extName] = __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 <module>
> extDict[extName] = __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.
--
WBR, wRAR
Back to linux.debian.maint.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Bug#937262: Help needed (Was: pdb2pqr: Python2 removal in sid/bullseye) Andreas Tille <andreas@an3as.eu> - 2019-12-12 17:20 +0100
Re: Help with scons needed (Was: Help needed (Was: pdb2pqr: Python2 removal in sid/bullseye)) Scott Talbert <swt@techie.net> - 2019-12-12 21:50 +0100
Bug#937262: Help with scons needed (Was: Help needed (Was: pdb2pqr: Python2 removal in sid/bullseye)) Andreas Tille <andreas@an3as.eu> - 2019-12-13 10:00 +0100
Re: Bug#937262: Help with scons needed (Was: Help needed (Was: pdb2pqr: Python2 removal in sid/bullseye)) Andrey Rahmatullin <wrar@debian.org> - 2019-12-13 11:30 +0100
Re: Bug#937262: Help with scons needed (Was: Help needed (Was: pdb2pqr: Python2 removal in sid/bullseye)) Andreas Tille <andreas@an3as.eu> - 2019-12-13 13:10 +0100
Bug#937262: Help with scons needed (Was: Help needed (Was: pdb2pqr: Python2 removal in sid/bullseye)) Andrey Rahmatullin <wrar@debian.org> - 2019-12-13 13:30 +0100
Bug#937262: Help with scons needed (Was: Help needed (Was: pdb2pqr: Python2 removal in sid/bullseye)) Andreas Tille <tille@debian.org> - 2019-12-13 13:50 +0100
Bug#937262: Help with scons needed (Was: Help needed (Was: pdb2pqr: Python2 removal in sid/bullseye)) Andreas Tille <tille@debian.org> - 2019-12-13 16:00 +0100
Re: Bug#937262: Help with scons needed (Was: Help needed (Was: pdb2pqr: Python2 removal in sid/bullseye)) Andrey Rahmatullin <wrar@debian.org> - 2019-12-13 19:00 +0100
Bug#937262: Help needed (Was: pdb2pqr: Python2 removal in sid/bullseye) Andrey Rahmatullin <wrar@debian.org> - 2019-12-13 22:40 +0100
csiph-web