Un-sorted /unformated imports pyright error

why do i keep getting the un-sortted /unformated imports error?(i have spaces after the imports)
Repl link:

code snippet
```import flet
from flet import (Checkbox, Column, Container, Icon, Page, Row, Tab, Tabs,Text, TextField)

i tried using the isort library and it didn’t do anything which means that this has no sorting problem so what should i do

Hi @ahmadshaheen1 , welcome to the forums!
This is justa styling option to leave a line after each option. You can try this:

If this answers your queation, you can mark this post as a Solution.

what lightbulb icon do u mean?(i am on mobile)

Could you send a screenshot of the issue at your side?

here are the screenshots:


this is the other screenshot because new users can’t embed more than one screenshot:


i tried this:

it didn’t help either because i have already done all of these requirements and i still have the error

you can take a look at the full code in: https://replit.com/@ahmadshaheen1/Python-1?s=app


Hm, you can just type this after each import:

#type: ignore
1 Like

you helped me on 2 of my projects which had the same issue

he error you’re encountering, which is related to “unsorted/unformatted imports,” is a common coding convention issue. Many Python style guides recommend organizing your imports in a specific way to make your code more readable and maintainable.

In Python, the standard convention is to organize imports in the following order:

  1. Standard Library Imports
  2. Related Third-Party Imports
  3. Local (Your Own) Imports

In your code snippet, it appears that you’re importing from both a third-party module (flet) and specific components within that module. To resolve the “unsorted/unformatted imports” error, you should organize your imports in the recommended order.

Here’s an example of how you can reorganize your imports:

pythonCopy code

# Standard Library Imports (if any)
# Related Third-Party Imports
import flet
from flet import Checkbox, Column, Container, Icon, Page, Row, Tab, Tabs, Text, TextField

# Local (Your Own) Imports (if any)

this is already the same code you just copied and pasted it + this info is from the link. that i sent and i said that this didn’t help +the #type: ignore worked

An easier way is to go to pyproject.toml and remove the 'I' from the select variable list, or you can just allow code intelligence to automatically fix it with the light bulb.
Code intelligence can be configured, and knowing how to is very useful.

1 Like

thanks for your help but i will stick with the

#type: ignore 

method because i don’t know what the .toml extension is

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.