ImportError: cannot import name 'x' from 'y'
Looking at your error, it appears get_num_classes doesn't exist anymore. I verified this by looking that their github and docs.
It was removed after this commit.
ImportError: Cannot import name 'x'
Remove pptxbuilder.
from views.builder import builder_bp
Simple example, but the concept should be the same. Your exact code will be different of course.
receiving ImportError: cannot import name x from y
Your refactor.py
import something from __init__.py
; It makes circular import issue
.
#from .__init__ import API_BASE_URL
Import error - Cannot import name x from y
Try this in scraper.py
from vendors.testing.products import TestProducts
Or
import vendors.testing.products as product
class scraper:
def __init__(self):
self.product = product.TestProducts()
Use self.product
to access any function of TestProducts inside the class scraper.
ImportError: cannot import name
The problem is that you have a circular import:
in app.py
from mod_login import mod_login
in mod_login.py
from app import app
This is not permitted in Python. See Circular import dependency in Python for more info. In short, the solution are
- either gather everything in one big file
- delay one of the import using local import
Related Topics
How to Extract a Floating Number from a String
How to Remove List Elements in a For Loop in Python
How to Find the Mountpoint a File Resides On
Python Convert Microsoft Office Docs to Plain Text on Linux
Cant Get Pyperclip to Use Copy and Paste Modules on Python3
How to Delete a Directory Created with Tempfile.Mkdtemp
(Still) Cannot Properly Install Lxml 2.3 for Python, But at Least 2.2.8 Works
How to Start/Stop Linux Processes with Python
Auto Executable Python File Without Opening from Terminal
Sieve of Eratosthenes - Finding Primes Python
Beautiful Soup: 'Resultset' Object Has No Attribute 'Find_All'
Change Working Directory in Shell with a Python Script
Running Process of Remote Ssh Server in the Background Using Python Paramiko
Asyncio in Corroutine Runtimeerror: No Running Event Loop
Bash: Variable in Single Quote
Ctypes Loading a C Shared Library That Has Dependencies
Trouble Connecting to Phantomjs Webdriver Using Python and Selenium