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
594 Views
(@awan)
Posts: 7
Active Member
Topic starter
 

 
Posted : 01/21/2024 6:44 am
Hasan Aboul Hasan
(@admin)
Posts: 1276
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

Β 

 
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

and some time this will give error

 
Posted : 01/22/2024 4:31 am
Hasan Aboul Hasan
(@admin)
Posts: 1276
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: 1276
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: 1276
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

Β  toΒ  app.main:app

 
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: 99
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.

Β 

 
Posted : 04/29/2024 5:10 am
Page 1 / 2
Share:
[the_ad_group id="312"]