Python SDK circular import error
See original GitHub issueI am trying to make a connection to the azure queue in Python but I am getting a circular import error.
Here’s my code: `from azure.storage.queue import (QueueClient)
connection_str = “”,
q_name = “test2” queue_client = QueueClient.from_connection_string(connection_str, q_name) queue_client.create_queue()`
Error I am getting:
from azure.storage.queue import (QueueClient) ImportError: cannot import name 'QueueClient' from partially initialized module 'azure.storage.queue' (most likely due to a circular import) (/home/deepak/azure-env/lib/python3.8/site-packages/azure/storage/queue/__init__.py)
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
class - Resolve circular import error in python - Stack Overflow
Class B won't be imported until you instantiate class A , by which time the module already has been imported fully by module...
Read more >Python Circular Import Problem and Solutions
Generally, the Python Circular Import problem occurs when you accidentally name your working file the same as the module name and those modules...
Read more >How to Solve Circular Import Error in Python - GyanBlog
Understand Circular Import. When you do simple import XYZ , it will work fine. By the time the code runs, all the modules...
Read more >Avoiding Circular Imports in Python | by André Menck - Medium
We can trivially fix this particular circular import by changing our imports to import from the module where the object is actually defined....
Read more >Python Circular Imports Module: Solving Circular Import Problem
Circular importing is a conceptual error that is formed due to circular dependency created with the import statement in our Python program.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
hey @jalauzon-msft I figured out the issue. It was due to the file name which was queue.py. I think python causes this circular import error for any modules if their file name matches with the modules package file name.
Hi @deepak6422, thanks for following up on this. It looks like this was indeed the cause as I was able to reproduce this on our end by naming the file
queue.py
. Interestingly this is not actually conflicting with our module since it’s calledazure.storage.queue
but instead with one of our dependencies,six
(used byurllib
). They have a module namedqueue
which is causing this error. Unfortunately, there is not a lot we can do about that right now so just using a different file name is probably the best solution.Thanks again for helping to find this. We can now recommend others against that file name if we see this issue in the future.