python3 package import difference?

Tobiah toby at tobiah.org
Wed Aug 7 11:35:36 EDT 2024


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!


More information about the Python-list mailing list