pytti-tools / pytti-notebook

Start here
https://pytti-tools.github.io/pytti-book/intro.html
MIT License
110 stars 25 forks source link

circular import in notebook that didn't come up in pytest end-to-end runs #25

Closed dmarx closed 2 years ago

dmarx commented 2 years ago

ImportError Traceback (most recent call last) /tmp/ipykernel_2058627/2608867653.py in 4 from loguru import logger 5 from omegaconf import OmegaConf ----> 6 from pytti.workhorse import _main as render_frames 7 8 CONFIG_BASE_PATH = "config"

~/miniconda3/envs/sandbox/lib/python3.9/site-packages/pytti/workhorse.py in 29 30 logger.info("Loading pytti...") ---> 31 from pytti.Notebook import ( 32 change_tqdm_color, # why though? 33 get_last_file,

~/miniconda3/envs/sandbox/lib/python3.9/site-packages/pytti/Notebook.py in 16 from PIL import Image 17 ---> 18 from pytti.LossAug import Loss as LossType 19 20 # https://stackoverflow.com/questions/15411967/how-can-i-check-if-code-is-executed-in-the-ipython-notebook

~/miniconda3/envs/sandbox/lib/python3.9/site-packages/pytti/LossAug/init.py in 44 45 from pytti.LossAug.TVLoss import TVLoss ---> 46 from pytti.LossAug.MSELoss import MSELoss 47 from pytti.LossAug.OpticalFlowLoss import OpticalFlowLoss, TargetFlowLoss 48 from pytti.LossAug.DepthLoss import DepthLoss

~/miniconda3/envs/sandbox/lib/python3.9/site-packages/pytti/LossAug/MSELoss.py in 4 from torch.nn import functional as F 5 from pytti.LossAug import Loss ----> 6 from pytti.Notebook import Rotoscoper 7 from pytti import DEVICE, fetch, parse, vram_usage_mode 8 import torch

ImportError: cannot import name 'Rotoscoper' from partially initialized module 'pytti.Notebook' (most likely due to a circular import) (/home/dmarx/miniconda3/envs/sandbox/lib/python3.9/site-packages/pytti/Notebook.py)

dmarx commented 2 years ago

fixed with https://github.com/pytti-tools/pytti-core/commit/634089a085e7dfc6a55c8ed1084a06728ec17cc1

still not entirely clear why this only cropped up when I tried to run stuff from the notebook, but just goes to show: need to diversify the testing paradigm