Skip to content

Forum in maintenance, we will back soon 🙂

error while debugin...
 
Notifications
Clear all

[Solved] error while debuging

17 Posts
4 Users
7 Reactions
381 Views
(@awan)
Posts: 7
Active Member
Topic starter
 
error
 
Posted : 01/21/2024 6:44 am
Hasan Aboul Hasan
(@admin)
Posts: 1219
Member Admin
 

try 2 dots instead of one.

can you please show a screenshot of your project files and hierarchy

 
Posted : 01/21/2024 9:08 am
SSAdvisor
(@ssadvisor)
Posts: 1139
Noble Member
 

@awan do you have an __init__.py file in your current directory?

Where does your routers.py file or routers directory exist?

Please provide a public GitHub URL to your code to make it easier for us to help you.

Regards,
Earnie Boyd, CEO
Seasoned Solutions Advisor LLC
Schedule 1-on-1 help
Join me on Slack

 
Posted : 01/21/2024 3:18 pm
(@awan)
Posts: 7
Active Member
Topic starter
 

Sir, the code is the same that sir, is given at the end of Build and Sell APIs - Establish a New Income Stream! coursre

err

 

 
Posted : 01/22/2024 4:24 am
(@awan)
Posts: 7
Active Member
Topic starter
 

@admin sir, I have tried many things but the error is not solved here is  the screen shot

err

and some time this will give error

erro
 
Posted : 01/22/2024 4:31 am
Hasan Aboul Hasan
(@admin)
Posts: 1219
Member Admin
 

@awan, this is not a problem; it is just showing that some functions may be deprecated. Hover over it and read the message. 

Anyway, let's focus on the main problem first. 

I tried the template now from my side, and it worked perfectly, did you try to debug step by step to see where it is breaking exactly?

did you add routers and functions? or is it just my template without any changes?

 

 
Posted : 01/22/2024 6:24 am
(@awan)
Posts: 7
Active Member
Topic starter
 

@admin I tried both add routers and functions also and tried to run just your template without any changes. 

every time this error show while debugging

 

Exception has occurred: ImportError
attempted relative import with no known parent package
File "C:\Users\ahsan\OneDrive\Desktop\Python-Fast-API-Template-main\Python-Fast-API-Template-main\app\main.py", line 20, in <module> from .routers import tools ImportError: attempted relative import with no known parent packag
 
Posted : 01/22/2024 6:42 am
Hasan Aboul Hasan
(@admin)
Posts: 1219
Member Admin
 

can you please try to replace the routers important statement with this:

from app.routers import tools

and see if the error jumps to the next line

 
Posted : 01/22/2024 6:55 am
(@awan)
Posts: 7
Active Member
Topic starter
 

@admin thanks sir error solved it was in launch.json file

 
Posted : 01/22/2024 8:01 am
Hasan Aboul Hasan
(@admin)
Posts: 1219
Member Admin
 

@awan what exactly the error? is there something I need to fix in my template?

 
Posted : 01/22/2024 8:31 am
(@awan)
Posts: 7
Active Member
Topic starter
 

@admin No, no sir the error was on my side your template is fully working

 
Posted : 01/22/2024 8:43 am
SSAdvisor
(@ssadvisor)
Posts: 1139
Noble Member
 

@awan can you please show us what you changed to make it work? It will help us help others in the future.

Regards,
Earnie Boyd, CEO
Seasoned Solutions Advisor LLC
Schedule 1-on-1 help
Join me on Slack

 
Posted : 01/23/2024 1:31 am
(@awan)
Posts: 7
Active Member
Topic starter
 

@ssadvisor I simply change in the launch.json main:app

1111111111

  to  app.main:app

2222222222
 
Posted : 01/23/2024 9:05 am
SSAdvisor
(@ssadvisor)
Posts: 1139
Noble Member
 

@awan thanks for sharing, it makes sense based on your directory structure.

Regards,
Earnie Boyd, CEO
Seasoned Solutions Advisor LLC
Schedule 1-on-1 help
Join me on Slack

 
Posted : 01/24/2024 1:18 am
Dim2001
(@dassa)
Posts: 95
Member
 

@ssadvisor My folders structure is not like above and also I don't have launch.json? did I missed something from the course? because I get above error.

Screenshot 5

 

 
Posted : 04/29/2024 5:10 am
Page 1 / 2
Share: