You do

from queue import *

This imports all the classes from the queue module already. Change that line to

q = Queue(maxsize=0)

CAREFUL: "Wildcard imports (from import *) should be avoided, as they make it unclear which names are present in the namespace, confusing both readers and many automated tools". (Python PEP-8)

As an alternative, one could use:

from queue import Queue

q = Queue(maxsize=0)
Answer from David Robinson on Stack Overflow
🌐
Python
docs.python.org › 3 › library › queue.html
queue — A synchronized queue class
February 23, 2026 - Example of how to wait for enqueued tasks to be completed: import threading import queue q = queue.Queue() def worker(): while True: item = q.get() print(f'Working on {item}') print(f'Finished {item}') q.task_done() # Turn-on the worker thread.
🌐
GeeksforGeeks
geeksforgeeks.org › dsa › stack-queue-python-using-module-queue
Stack and Queue in Python using queue Module - GeeksforGeeks
August 1, 2022 - When we try to add data into a Queue above is maxsize, it is called OverFlow(Queue Full) and when we try removing an element from an empty, it's called Underflow. put() and get() do not give error upon Underflow and Overflow, but goes into an infinite loop. Implementation: python3 · import queue L = queue.Queue(maxsize=6) # qsize() give the maxsize # of the Queue print(L.qsize()) L.put(5) L.put(9) L.put(1) L.put(7) # Return Boolean for Full # Queue print("Full: ", L.full()) L.put(9) L.put(10) print("Full: ", L.full()) print(L.get()) print(L.get()) print(L.get()) # Return Boolean for Empty # Queue print("Empty: ", L.empty()) print(L.get()) print(L.get()) print(L.get()) print("Empty: ", L.empty()) print("Full: ", L.full()) # This would result into Infinite # Loop as the Queue is empty.
Discussions

queue ImportError in python 3 - Stack Overflow
Traceback (most recent call last): ... "/Users/bli1/Development/QE/TrinityTestFramework/poc/utils/tree_diff.py", line 5, in import queue ImportError: No module named queue ... #!/usr/bin/env python3 import sys # access to basic things like sys.argv import os # access pathname ... More on stackoverflow.com
🌐 stackoverflow.com
python - ImportError: No module named 'Queue' - Stack Overflow
Is there a way to import the real module without naming the local queue.py? 2017-10-05T08:03:14.83Z+00:00 ... It's because of the Python version. In Python 2.x it's import Queue as queue; on the contrary in Python 3 it's import queue. More on stackoverflow.com
🌐 stackoverflow.com
getting an error message in my python.

You should probably install that module. Dude. Google.

More on reddit.com
🌐 r/pokemongodev
5
0
March 7, 2018
Why can't I import queue? - No module named queue
Try 'import Queue' with a capital letter. If renpy uses python 2.7, that's how you import the module. More on reddit.com
🌐 r/RenPy
2
2
September 26, 2021
🌐
GeeksforGeeks
geeksforgeeks.org › python › queue-in-python
Queue in Python - GeeksforGeeks
December 11, 2025 - Python · from queue import Queue q = Queue(maxsize=3) print("Initial size:", q.qsize()) q.put('a') q.put('b') q.put('c') print("Is full:", q.full()) print("Elements dequeued from the queue:") print(q.get()) print(q.get()) print(q.get()) print("Is ...
🌐
Real Python
realpython.com › ref › stdlib › queue
queue | Python Standard Library – Real Python
Here’s a quick example: Python · >>> import queue >>> tasks = queue.Queue() >>> tasks.put("task1") >>> tasks.put("task2") >>> tasks.get() 'task1' >>> tasks.get() 'task2' Provides thread-safe FIFO, LIFO, and priority queues ·
🌐
Medium
basillica.medium.com › working-with-queues-in-python-a-complete-guide-aa112d310542
Working with Queues in Python — A Complete Guide | by Basillica | Medium
March 27, 2024 - You can initialize a Queue instance like this: from queue import Queue q = Queue() # The key methods available are: qsize() # - Get the size of the queue empty() # - Check if queue is empty full() # - Check if queue is full put(item) # - Put ...
🌐
AskPython
askpython.com › home › python queue module
Python Queue Module - AskPython
February 26, 2020 - ... By default, this has a capacity of 0, but if you want to explicitly mention it, you can do so using: ... We can insert and retrieve values into the Queue using the queue.get() and queue.put() methods.
Find elsewhere
🌐
Python
docs.python.org › 3 › library › asyncio-queue.html
Queues — Python 3.14.4 documentation
February 22, 2026 - Queues can be used to distribute workload between several concurrent tasks: import asyncio import random import time async def worker(name, queue): while True: # Get a "work item" out of the queue. sleep_for = await queue.get() # Sleep for the ...
🌐
W3Schools
w3schools.com › python › ref_module_queue.asp
Python queue Module
Python Examples Python Compiler ... · ❮ Standard Library Modules · Create a FIFO queue, put an item, then get it back: import queue q = queue.Queue() q.put('task1') print(q.get()) Try it Yourself » ·...
🌐
Great Learning
mygreatlearning.com › blog › it/software development › python queue
Python Queue
October 14, 2024 - FIFO means the element that is inserted first will be the first element to be removed from the list. To implement the FIFO queue, we are required to import the queue() module in Python.
🌐
PyPI
pypi.org › project › queuelib
queuelib
JavaScript is disabled in your browser. Please enable JavaScript to proceed · A required part of this site couldn’t load. This may be due to a browser extension, network issues, or browser settings. Please check your connection, disable any ad blockers, or try using a different browser
🌐
W3Schools
w3schools.com › python › python_dsa_queues.asp
Queues with Python
Queues can be used to implement job scheduling for an office printer, order processing for e-tickets, or to create algorithms for breadth-first search in graphs. Queues are often mentioned together with Stacks, which is a similar data structure described on the previous page. For Python lists (and arrays), a Queue can look and behave like this:
🌐
Guru99
guru99.com › home › python › python queue: fifo, lifo example
Python Queue: FIFO, LIFO Example
August 12, 2024 - By default, the size of the queue is infinite and you can add any number of items to it. In case you want to define the size of the queue the same can be done as follows · import queue q1 = queue.Queue(5) #The max size is 5.
🌐
iO Flood
ioflood.com › blog › python-queue
Python Queue Class | Usage Guide (With Examples)
February 5, 2024 - Here’s how you can create a queue, add items to it, and remove items from it: import queue # Create a queue q = queue.Queue() # Add items to the queue q.put('Apple') q.put('Banana') q.put('Cherry') # Remove items from the queue print(q.get()) ...
🌐
DaniWeb
daniweb.com › programming › software-development › threads › 251918 › import-queue-dont-exist
python - Import queue dont exist? [SOLVED] | DaniWeb
January 10, 2010 - In your original example, Queue imported fine. It was the statement calling Queue that was the problem. Try the first two lines of redyugi's example and see what you get. from Queue import Queue ##<----- imports … — woooee 814 Jump to Post ... Traceback (most recent call last): File "D:\Python26\test.py", line 166, in <module> main() File "D:\Python26\test.py", line 19, in main q = Queue.Queue() AttributeError: class Queue has no attribute 'Queue'
🌐
Javatpoint
javatpoint.com › python-queue-module
Python Queue Module - Javatpoint
Python Queue Module with python, tutorial, tkinter, button, overview, entry, checkbutton, canvas, frame, environment set-up, first python program, operators, etc.
🌐
Intellipaat
intellipaat.com › home › blog › queue in python – implementation explained
Queue in Python: How to Implement Queue in Python
October 14, 2025 - In the case of the FIFO queue, the item that we enter first gets out first. Let’s go through the code step by step to understand how the menu-driven script works: ... Here, we import the `deque` class from the `collections` module.