Linked Questions

259 votes
20 answers
971k views

I have two python modules: a.py import b def hello(): print "hello" print "a.py" print hello() print b.hi() b.py import a def hi(): print "hi" When I run a.py, I get: AttributeError: '...
Stephen Hsu's user avatar
  • 5,207
220 votes
3 answers
238k views

I know the issue of circular imports in python has come up many times before and I have read these discussions. The comment that is made repeatedly in these discussions is that a circular import is a ...
BWW's user avatar
  • 2,319
97 votes
7 answers
97k views

Let's say I have the following directory structure: a\ __init__.py b\ __init__.py c\ __init__.py c_file.py d\ __init__.py ...
Ram Rachum's user avatar
  • 89.5k
55 votes
5 answers
65k views

I got an error I don't understand ! cannot import name Item In my model, I have items. These items are required for actions. But some of these items have an effect on actions : items from django....
Cyril F's user avatar
  • 1,359
21 votes
1 answer
48k views

I have this code: import matplotlib.pyplot as p1lt #define data x = [1, 2, 3, 4, 5, 6] y = [3, 7, 14, 19, 15, 11] #create line plot p1lt.plot(x, y) #show line plot p1lt.show() I get an error that ...
Gaff's user avatar
  • 339
3 votes
3 answers
22k views

I am able to run my flask tests utilizing the following command python -m unittest discover -p testing.py but when I try to run python app.py runserver it shows me the following error message: ...
paula.em.lafon's user avatar
3 votes
2 answers
34k views

Trying to execute the following code to check how the progress bar works with the tqdm module but receiving an "ImportError: cannot import name 'tqdm' from 'tqdm' " Code from tqdm import ...
Mohammed Ansari's user avatar
-4 votes
2 answers
9k views

Python newbie here. Let's say I have two Python scripts main.py and lib.py. There is a variable (not a function) in lib.py that I want to use in main.py. I imported lib.py in main.py and called lib....
Crolle's user avatar
  • 832
0 votes
1 answer
8k views

So I am creating a Gmail Sender app using Tkinter and I have a function called send_email and it is inside the SendEmail.py. But every time I run the code it gives me this error: Exception in Tkinter ...
YamiAtem's user avatar
  • 152
0 votes
1 answer
2k views

I have taken a piece of code from https://pynput.readthedocs.io/en/latest/keyboard.html and modified it so that it stores keystrokes into a text file. However, I get the error message in the output: ...
Pkd's user avatar
  • 29
-1 votes
1 answer
3k views

I have an issue with relative imports in python. (I really can't do these imports the other way...) Structure of my project is similar to this: app ├───schemas └───__init__.py └───...
aremm's user avatar
  • 3
1 vote
1 answer
558 views

society. I'm trying to understand the OOP programming and I'm facing some issues and asking for help. Here the example: I'm trying to create all objects under one class and then I want to inherit ...
Nikolas Miller's user avatar
0 votes
0 answers
264 views

I have the folllowing folder structure on my python project: As I understand from this link that explains a python file structure my whole python project will run from the bin/rain_it.py. The code ...
luisgepeto's user avatar
1 vote
0 answers
242 views

My problem is: I am unable to import the model's Role class (Or anything from the models for that matter). I have a simple file structure in my Flask app (theres more but the problem is here): myapp ...
Johnston's user avatar
  • 21.1k
0 votes
1 answer
223 views

I have a problem that the program throws this error: ImportError: cannot import name 'idkom' from partially initialized module 'idkom' (most likely due to a circular import) (d: \ Python \ Crystalia \ ...
barteksh's user avatar

15 30 50 per page
1
2 3 4 5 6