#๐ Circular import
22 messages ยท Page 1 of 1 (latest)
@tribal phoenix
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
help me with this circular import plz
Circular imports are, by definition, waiting on other scripts to finish importing by other scripts, etc.
You just need to rearrange your imports so that they don't try to import each other
Another way would be to just put similar scripts into 1 script. So there's no circular import at all
i try to put the import line in the function but when i do the function get repeated
I don't understand what that looks like
Can you paste the code here or in a pastebin service please?
If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.
def display_outcomes(outcomes):
"""
Displays the calculated outcomes in a clear and formatted way.
"""
# Printing outcomes to the console
print(f'''
data file selected is {outcomes[14]}
*************************** ''')
output_format = f'''
The total number of vehicles recorded for this date is {outcomes[0]}
The total number of trucks recorded for this date is {outcomes[1]}
The total number of electric vehicles for this date is {outcomes[2]}
The total number of two-wheeled vehicles for this date is {outcomes[3]}
The total number of Busses leaving Elm Avenue/Rabbit Road heading North is {outcomes[4]}
The total number of Vehicles through both junctions not turning left or right is {outcomes[5]}
The percentage of total vehicles recorded that are trucks for this date is {outcomes[6]}%
the average number of Bikes per hour for this date is {outcomes[7]}
The total number of Vehicles recorded as over the speed limit for this date is {outcomes[8]}
The total number of vehicles recorded through Elm Avenue/Rabbit Road junction is {outcomes[9]}
The total number of vehicles recorded through Hanley Highway/Westway junction is {outcomes[10]}
{outcomes[11]}% of vehicles recorded through Elm Avenue/Rabbit Road are scooters.
The highest number of vehicles in an hour on Hanley Highway/Westway is {outcomes[12][0]}
The most vehicles through Hanley Highway/Westway were recorded between {outcomes[12][1]}:00 and {(outcomes[12][1]) + 1}:00
The number of hours of rain for this date is {outcomes[13]} '''
print(output_format) # i tried to import the python file here
h_module = HistogramApp(outcomes[15], outcomes[14][12:20])
h_module.run()
save_results_to_file(outcomes, output_format)
Hey @tribal phoenix!
It looks like you are trying to paste code into this channel.
You seem to be using the wrong symbols to indicate where the code block should start. The correct symbols would be ```, not '''.
Here is an example of how it should look:
```
Hello, world!
```
This will result in the following:
Hello, world!```
You can **edit your original message** to correct your code block.
i added them
You need to share the links here
ok so... why can't you just put them into one file?
well lecturer told he need that task E in the other python file
ok thank you ill try
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.