Deutsch   English   Français   Italiano  
<mailman.34.1723079886.2890.python-list@python.org>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!weretis.net!feeder8.news.weretis.net!fu-berlin.de!uni-berlin.de!not-for-mail
From: Cameron Simpson <cs@cskk.id.au>
Newsgroups: comp.lang.python
Subject: Re: python3 package import difference?
Date: Thu, 8 Aug 2024 11:17:56 +1000
Lines: 17
Message-ID: <mailman.34.1723079886.2890.python-list@python.org>
References: <v90488$35uk5$1@dont-email.me> <ZrQcxHnUn0bLK46t@cskk.homeip.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii; format=flowed
X-Trace: news.uni-berlin.de 0vdyTjPvv8vv0t+rNHIRBQrDiFY5TsWRa6kCEOO/0p+A==
Cancel-Lock: sha1:2hnT+B3769UU5qi/2uF3SMgxpDY= sha256:MojLgztwfBvNfi20cuzX6aJsPk4t7oRhZkizzMw7QkY=
Return-Path: <cameron@cskk.id.au>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=none reason="no signature";
 dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.000
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'traceback': 0.04; '(most':
 0.05; 'absolute': 0.05; 'last):': 0.05; 'subject:import': 0.07;
 'cc:addr:python-list': 0.09; 'cheers,': 0.11; 'cc:no real
 name:2**0': 0.14; 'import': 0.15; 'cameron': 0.16; 'from:addr:cs':
 0.16; 'from:addr:cskk.id.au': 0.16; 'from:name:cameron simpson':
 0.16; 'message-id:@cskk.homeip.net': 0.16; 'received:13.237':
 0.16; 'received:13.237.201': 0.16; 'received:13.237.201.189':
 0.16; 'received:cskk.id.au': 0.16; 'received:id.au': 0.16;
 'received:mail.cskk.id.au': 0.16; 'simpson': 0.16;
 'subject:package': 0.16; 'wrote:': 0.16; 'python': 0.16;
 'cc:addr:python.org': 0.20; 'cc:2**0': 0.25; 'header:User-
 Agent:1': 0.30; 'module': 0.31; 'same': 0.34; 'package': 0.34;
 'header:In-Reply-To:1': 0.34; 'received:au': 0.35; 'file': 0.38;
 'want': 0.40; 'skip:m 20': 0.63; 'received:13': 0.64; 'top': 0.65;
 'named': 0.65; 'received:userid': 0.66; 'imports': 0.84; 'skip:"
 40': 0.84
Mail-Followup-To: Tobiah <toby@tobiah.org>, python-list@python.org
Content-Disposition: inline
In-Reply-To: <v90488$35uk5$1@dont-email.me>
User-Agent: Mutt/2.2.13 (2024-03-09)
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
 <python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
 <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
 <mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <ZrQcxHnUn0bLK46t@cskk.homeip.net>
X-Mailman-Original-References: <v90488$35uk5$1@dont-email.me>
Bytes: 3478

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>