Help with Python circular error

MRAB python at mrabarnett.plus.com
Tue Jun 15 13:13:20 EDT 2021


On 2021-06-15 17:49, Chris Angelico wrote:
> On Wed, Jun 16, 2021 at 2:45 AM Arak Rachael <arakelthedragon at gmail.com> wrote:
>>
>> Hi to everyone,
>>
>> I am having a problem with this error, I created a package and uploaded it to Test PyPi, but I can not get it to work, can someone help me please?
>>
>> https://test.pypi.org/manage/project/videotesting/releases/'
>>
>> The error:
>>
>> /home/user/anaconda3/envs/testing/bin/python /home/user/devel/python.assignments/topgis-viz/topgis-test.py
>> Traceback (most recent call last):
>>   File "/home/user/devel/python.assignments/topgis-viz/topgis-test.py", line 10, in <module>
>>     from videotesting import downsample_and_save_npz
>>   File "/home/user/anaconda3/envs/testing/lib/python3.8/site-packages/videotesting/__init__.py", line 7, in <module>
>>     from videotesting import extract_video
>> ImportError: cannot import name 'extract_video' from partially initialized module 'videotesting' (most likely due to a circular import) (/home/user/anaconda3/envs/testing/lib/python3.8/site-packages/videotesting/__init__.py)
>>
> 
> Hard to diagnose without the source code, but I'm thinking that your
> __init__.py is probably trying to import from elsewhere in the
> package? If so, try "from . import extract_video" instead.
> 
Well, the traceback says that videotesting/__init__.py has:
     from videotesting import extract_video

so it is trying to import from itself during initialisation.


More information about the Python-list mailing list