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 <andr...@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
>
>

Reply via email to