Re: python3 package import difference?

Liste des GroupesRevenir à cl python 
Sujet : Re: python3 package import difference?
De : cs (at) *nospam* cskk.id.au (Cameron Simpson)
Groupes : comp.lang.python
Date : 08. Aug 2024, 03:17:56
Autres entêtes
Message-ID : <mailman.34.1723079886.2890.python-list@python.org>
References : 1 2
User-Agent : Mutt/2.2.13 (2024-03-09)
On 07Aug2024 08:35, Tobiah <toby@tobiah.org> wrote:
When I do the same import with python3, I get:
>
   Traceback (most recent call last):
     File "/home/toby/me", line 1, in <module>
       import rcs.dbi
     File "/usr/regos-1.0/lib/python/rcs/dbi/__init__.py", line 1, in <module>
       from dbi import *
   ModuleNotFoundError: No module named 'dbi'
Python 3 imports are absolute (they start from the top of the package tree and you have no `dbi` at the top). You want a relative import i.e.:
     from .dbi import *
Cheers,
Cameron Simpson <cs@cskk.id.au>

Date Sujet#  Auteur
7 Aug 24 * python3 package import difference?5Tobiah
7 Aug 24 +- Re: python3 package import difference?1Stefan Ram
8 Aug 24 +- Re: python3 package import difference?1Ronaldo Sc
8 Aug 24 +- Re: python3 package import difference?1Chris Angelico
8 Aug 24 `- Re: python3 package import difference?1Cameron Simpson

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal