Help with Python circular error
Arak Rachael
arakelthedragon at gmail.com
Wed Jun 16 04:32:38 EDT 2021
On Tuesday, 15 June 2021 at 19:30:28 UTC+2, Chris Angelico wrote:
> On Wed, Jun 16, 2021 at 3:17 AM MRAB <pyt... at mrabarnett.plus.com> wrote:
> >
> > On 2021-06-15 17:49, Chris Angelico wrote:
> > > On Wed, Jun 16, 2021 at 2:45 AM Arak Rachael <arakelt... 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.
> Yes, but what we can't tell is what the intention is. It could be
> trying to import from its own package (in which case my suggestion
> would be correct), or it could be trying to import from something
> completely different (in which case the solution is to rename
> something to avoid the conflict). Or it could be something else
> entirely.
>
> ChrisA
Thanks all!
I have __init__.py in the create and uploaded package and I have __init_.py in the new package, which is not ready yet. Its 2 projects, but I am using project 1 into project 2.
Here is the first package as a .zip
https://www.dropbox.com/s/lkz0qf4mq9afpaz/video-testing-package1.zip?dl=0
Here is the second project in which I try to use the first one:
https://www.dropbox.com/s/sxjpip23619fven/topgis-viz-package2.zip?dl=0
More information about the Python-list
mailing list