Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.maint.python > #11780
| Path | csiph.com!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Ghislain Vaillant <ghisvail@gmail.com> |
| Newsgroups | linux.debian.maint.python |
| Subject | Re: 2to3 adds '.' in front dir of "from dir import ..." statements (Was: [MoM] lefse migration to python 3]) |
| Date | Tue, 10 Sep 2019 08:30:01 +0200 |
| Message-ID | <yEHP3-56m-3@gated-at.bofh.it> (permalink) |
| References | <yEHm1-4FK-1@gated-at.bofh.it> |
| X-Mailbox-Line | From debian-python-request@lists.debian.org Tue Sep 10 06:24:54 2019 |
| Old-Return-Path | <ghisvail@gmail.com> |
| X-Amavis-Spam-Status | No, score=-3.199 tagged_above=-10000 required=5.3 tests=[BAYES_00=-2, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=2, LDO_WHITELIST=-5, MEDS2=2, RCVD_IN_DNSWL_NONE=-0.0001] autolearn=no autolearn_force=no |
| X-Policyd-Weight | using cached result; rate: -5.5 |
| Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=EpCxcdXN5QpcCDQxhBS0kP9XqXPyLMfEqaC/SbwDK2o=; b=kB8QDtqUxm82KegStP6hVfYZ2gHv9smClCFT1jzn9LuZorklWnMA5Wjwa5LiPdlYnX w9Ht8EmK0svTtmKR1hne1ZVyl8d5FmWf4ylZqsnOb4HK3ouRhwBXKXXpvKphuo//Z+vT V19hUbW1Gn7YJWkGh6oA2kZNhcwPve+dz/261nrqo0RianZTUzjnibnERaeq+EHt60t5 /CJRthdlEE8zpDbDpfPGbhqF/P605ikGYkJZsKyyht15PiZAZIpavMo+Q8995FmNeE3C cPSb3O6yT3pg7Ifw+fLa26CfyiQi80hcRGo9XWrYq9uU3aNskrrFZTLSeiaSOcFB2hZf Ju6Q== |
| X-Google-Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=EpCxcdXN5QpcCDQxhBS0kP9XqXPyLMfEqaC/SbwDK2o=; b=UFz/Nso49UHhl7U5WcyBGJRV4ZU/Xu7hExKOwc7tcQ4IDE2Qzwbb2Q1XxGxmzEKpni n+fHpGaalDe7vWPnKPAe3b3QQGF+avojWQ0Iz2RZRuWwvp1wkGhGUn0GZ8CcYJhCDdXp y3o7i4DMF6QW/u51xVtJAdy3thQ2OvvZSxq23zY+F3jc9+/qm2xWJi9ovEnHzPIIuwyk IfN7kDoVvSDgSs0ABfL0/p0XTbwC4ZPO36BdgqFzffLTCqc2J5dMcbF8oSYWsWlbN+GY +M7DZOx1dIrlIhvykJNH+6dwo7dm07iQsvAhLCAttKNgoCEp9rJI6GoQj1CW1a8KGNYp QLrA== |
| X-Gm-Message-State | APjAAAV9bfGk/rJVbapNy3oYdKTxR8IuBR8MwtFPaOfA8gf0E1Ag0TXV a4ToVEIj1LKpWAu9lahmKOyt9tC0Gc/WkXAemF+lhQ== |
| X-Google-SMTP-Source | APXvYqyK4PiNqNiNUDatrIoq3u0LOkZSpxO1RHP4QPEcfjgj0GklX8qR3cLQwWYxTVCQwuq+7CMOSRzB4Mz2BZD8mzk= |
| X-Received | by 2002:ac5:c5ba:: with SMTP id f26mr12792170vkl.32.1568096678123; Mon, 09 Sep 2019 23:24:38 -0700 (PDT) |
| MIME-Version | 1.0 |
| Content-Type | multipart/alternative; boundary="000000000000791afe05922cf58d" |
| X-Mailing-List | <debian-python@lists.debian.org> archive/latest/17301 |
| List-ID | <debian-python.lists.debian.org> |
| List-URL | <https://lists.debian.org/debian-python/> |
| List-Archive | https://lists.debian.org/msgid-search/CAFzxpWqaY-4WcGevFd6Mi1wSdJfXe1eSDQAp689Bh-9C6u789w@mail.gmail.com |
| Approved | robomod@news.nic.it |
| Lines | 136 |
| Organization | linux.* mail to news gateway |
| Sender | robomod@news.nic.it |
| X-Original-Cc | debian-python <debian-python@lists.debian.org>, Shayan Doust <hello@shayandoust.me> |
| X-Original-Date | Tue, 10 Sep 2019 08:24:26 +0200 |
| X-Original-Message-ID | <CAFzxpWqaY-4WcGevFd6Mi1wSdJfXe1eSDQAp689Bh-9C6u789w@mail.gmail.com> |
| X-Original-References | <20190910055047.otdspqnnnpkd55hp@an3as.eu> |
| Xref | csiph.com linux.debian.maint.python:11780 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
It results from the ambiguity between absolute and relative imports in Python 2. Here 2to3 considers your imports being relative, hence the added dot. I believe no dots would be added should a `from __future__ import absolute_import` be found in the preamble of the module. Hope this helps. Ghis Le mar. 10 sept. 2019 à 07:51, Andreas Tille <andreas@an3as.eu> a écrit : > Hi, > > in the process of the Python3 migration the package lefse was converted > using 2to3. The changes can be found in git[1]. I'm wondering about > the following diff created by 2to3: > > - from lefse import * > + from .lefse import * > > When calling a random binary of the resulting binary package lefse I > experienced: > > $ plot_features > Traceback (most recent call last): > File "/usr/bin/plot_features", line 6, in <module> > from .lefse import * > ModuleNotFoundError: No module named '__main__.lefse'; '__main__' is not a > package > > > I think the line > > from lefse import * > > should remain to keep that script functional. I now checked another > package (cain - nothing pushed yet) and here also 2to3 is changing > > from something import * > > to > > from .something import * > > Could somebody please enlighten me about this added '.' which does not > seem to work? > > Kind regards > > Andreas. > > [1] https://salsa.debian.org/med-team/lefse > > -- > http://fam-tille.de > >
Back to linux.debian.maint.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
2to3 adds '.' in front dir of "from dir import ..." statements (Was: [MoM] lefse migration to python 3]) Andreas Tille <andreas@an3as.eu> - 2019-09-10 08:00 +0200
Re: 2to3 adds '.' in front dir of "from dir import ..." statements (Was: [MoM] lefse migration to python 3]) Ghislain Vaillant <ghisvail@gmail.com> - 2019-09-10 08:30 +0200
Re: 2to3 adds '.' in front dir of "from dir import ..." statements (Was: [MoM] lefse migration to python 3]) Michael Kesper <mkesper@schokokeks.org> - 2019-09-12 09:30 +0200
Re: 2to3 adds '.' in front dir of "from dir import ..." statements (Was: [MoM] lefse migration to python 3]) Andreas Tille <andreas@an3as.eu> - 2019-09-12 09:50 +0200
Re: 2to3 adds '.' in front dir of "from dir import ..." statements (Was: [MoM] lefse migration to python 3]) Andrey Rahmatullin <wrar@debian.org> - 2019-09-12 11:10 +0200
csiph-web