Комментарии:
Awesome, thanks
ОтветитьVery very clear
ОтветитьThank you!
ОтветитьWhat if there is more than one main file that I need to debug in the same folder?
ОтветитьNot working for me :/
ОтветитьThank you for sharing, Very good Job!
ОтветитьYou are great!
ОтветитьJetBrain Intellij IDEA - FOREVER!!!!!
ОтветитьI asume, this will work only in VSCode. I.e. if I'll deploy my project somewhere else it won't work.
Ответитьthat was very helpfull thansks a ton
Ответитьhow for multiple paths please?
Ответитьif you are using a virual env and you've installed the package locally - its best to put below in either your workspace settings file - or maybe even your settings.json file
"python.analysis.extraPaths": [
"${execPath}"
],
Do we need to do this everytime we create a project? Is there a way to make vscode automatically add project folder to pythonpath?
Thanks!
For the intellisense part I agree.
But the basic problem is not solved with imports because the solution is restricted to VS Code. The script will still not work from command prompt so the antipattern issue is not resolved by this. Path has to be extended... Bad, I agree.
If there's a PEP against it they shouldn't only ban it but offer an acceptable solution too.
❤❤❤
You, sir, are awesome. I’ve been googling how to get my VScode debugger working properly with my project for hours now. Yours was the first to give me a pretty clear understanding of what was happening and how to resolve the issue. (I have my project’s main module 2 layers deep).
Thank you!!!!
it is not working
ОтветитьThis helped me a lot working with micropython too (as I need relative imports with sys.path.append on the controller, but want Intellisense when coding). Thanks!
ОтветитьI found many solutions, but you provided the best of them for both problems ("ModuleNotFoundError" and "Pylance reportMissingImports"). Thank you!
ОтветитьAs much as I appreciate the explanation and showcase of doing it inside VSCode, the solution feels a bit off imho. I'd rather use editable install of my sub module inside virtual environment (that I use anyway). Would be IDE agnostic.
ОтветитьI have this same problem with odoo library import tried settings.json and PYTHONPATH settings but it didnot work for me i still get the same import error. can you please help
ОтветитьFix Python Absolute Imports and Auto-completion in VSCode, could you please fix this issue as well
ОтветитьHi I am using Visual Studio 2022 and its very complicated and unable to find solution for same problem. Please help. Even I am unable to find Run & debug icon here.
ОтветитьThis is very bad advice, as it forces you to run scripts in vscode only.
Ответитьunfortunately it didn't work for me :(
Ответитьthanks for all ! I make an anti pattern during several day and now I can work easly :) thanks for all
Ответитьabsolutely thrash solution
ОтветитьI am new to vscode, and I searched stackoverflow and several other pages to end up getting all the confusing information. I am glad that I found out this channel finally to solve my problems. Thanks much!
ОтветитьGood explaination!
ОтветитьThanks for the topic, but didn't work for me....(( I'm trying to make import from a parallel directory and it doesn't work(((
ОтветитьCan't understand why microsoft leave this shit
ОтветитьMuch appreciated! That was very helpful!
Thanks!
Great tutorial! Thanks
ОтветитьGreat video. But where I know in my case where my_package is? I'm just unable to implement it!
Ответитьthat was great!but I have a question...vs code not showing mysql.connector auto complete suggestions what should I do for that?
ОтветитьThanks for this !
ОтветитьAwesome!!
ОтветитьI've been putting off fixing VS Code auto-completion for years. Thank you my man!
ОтветитьMany thanks man, for this amazing video, it took me hours to get rid of this!
Ответитьhelpful , simple to the point ..
Ответитьfixed it sub
ОтветитьShort and clear explanation .. keep making these sort of videos .. thank you !
ОтветитьThis is a suboptimal solution that works locally, and forces anyone that works on this project to use vscode as their IDE. The best solution is to package the extern directory as its own package and have it part of the requirements for the project, and then you can import it from there. Unfortunately, you are trying to fix an anti-pattern by promoting another one.
ОтветитьWould this solution work if someones else tries to use our project using another IDE, let's say Pycharm?
ОтветитьSorry but this is nonsense! Your entire project is now dependent on the IDE you use and if you were actually working with colleagues they would not be able to work with your project without also using the same editor. If you are using package and the loading mechanism correctly there should be no need to resort to this kind of nonsense. You do people no favors by promoting this kind of stuff.
ОтветитьDoing multiple settings just to help VS Code and nothing else? I think it is much better to turn extern into a proper package and install it using pip (could be an "editable" install for easier development) then it will work everywhere, not just in VS Code.
ОтветитьSubscribed! Really great video that saves my life!!
I have two questions.
1)What if I have multiple modules in the same folders that need the extended python path (or multiple extended python paths), can I just put the name of the second module after the first one?
2) It was fine for me to run the file under VS code and import the module from another directory. However, why did it still complains ModuleNotFoundError when I executed the python file via Terminal?