Click here to Skip to main content
15,745,737 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I underline the code as an error, I don’t understand how to fix it, for example, in the file, underlines this line as an error
from. import views

What I have tried:

I added spaces but it didn't help.
Updated 20-Nov-22 5:31am

1 solution

"." is not a module name.
See Iulian Onofrei's solution:[^]
Share this answer
Eva Smirnova 20-Nov-22 11:41am    
No, such an answer will not suit me, as always they will put everything together, there’s nothing you can’t figure out there, I don’t see any answers, I would like specifics on what’s wrong and how to correctly indicate, everything seems to be simple and understandable.
Dave Kreskowiak 20-Nov-22 12:14pm    

The format of the from statement to import stuff is this:
from packageName import itemName

Now look your from statement:
from. import views
You specified the pacakgeName as "." That's a "Package Relative Import," meaning the item you're trying to import should be in the same package as the from statement.

It's telling you that "views" doesn't exist in your package.

Here is how the import system works:
Scroll down to section 5.7 Package Relative Imports
Eva Smirnova 20-Nov-22 14:39pm    
I want to import the view file in my code, is there something not correctly indicated there? I write the code according to the video, everything is written in the same way and everything works.
Dave Kreskowiak 20-Nov-22 17:15pm    
If the file is in the same folder as your current .py file, then it should be a simple
from view import *

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900