python3 package import difference?

Liste des GroupesRevenir à cl python 
Sujet : python3 package import difference?
De : toby (at) *nospam* tobiah.org (Tobiah)
Groupes : comp.lang.python
Date : 07. Aug 2024, 17:35:36
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v90488$35uk5$1@dont-email.me>
User-Agent : Mozilla Thunderbird
I have an old library from 20 some years ago
for use with python2, that is structured like this:
     rcs
     ├── dbi
     │   ├── __init__.py
     │   ├── dbi.py
     │   └── regos.py
     └── __init__.py  --   *empty*
the __init__.py file under 'rcs' is empty.
The one under rcs.dbi contains:
     from dbi import *
     from regos import *
With python2, I'd go:
         import rcs.dbi
then I'd have access to stuff in regos.py
as:
         rcs.dbi.feature()  (Where 'feature' is defined in regos.py)
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'
What's changed, and how do I fix it?
Thanks!

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