Python Forum
visual studio code python how to get source code of import module definitian
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
visual studio code python how to get source code of import module definitian
#1
im debugging python source code using windows WSL some modules that i import i can see the source and some i can't , why i can't ?

here i try to find out where is the module installed in WSL

[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ansible
>>> ansible.__file__
'/home/boo/projects/ansible/lib/ansible/__init__.py'
>>> import site; site.getsitepackages()
['/usr/local/lib/python3.8/dist-packages', '/usr/lib/python3/dist-packages', '/usr/lib/python3.8/dist-packages']
>>> cd
KeyboardInterrupt
>>>      
here i can see that i can't access :
[Image: M2Y2x.png]

here i can see that i can access :
https://i.stack.imgur.com/E8mzR.png

i checked if the python that VSCODE is using the same as the one installed
https://i.stack.imgur.com/s0aBj.png

tst@TEST:~/.local/lib/python3.8/site-packages/ansible/cli$  /bin/python3.8
Python 3.8.2 (default, Apr 27 2020, 15:53:34)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ansible
>>> ansible.__file__
'/home/tst/.local/lib/python3.8/site-packages/ansible/__init__.py'
Reply
#2
You most choose right interpreter down in left corner(click over to choose).
In your image it now point to bin/python3,it should point to /usr/local/lib/python3.8 where you have ansible installed.
Reply
#3
i found the solution
justMyCode:false
in visualstudiocode
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Visual Studio for Python 357mag 4 89,132 Dec-21-2024, 10:02 AM
Last Post: ratwolf
  import vs inserting code Skaperen 10 3,016 Jun-26-2024, 09:58 PM
Last Post: Skaperen
  Can you recommend me a vps that will run api python code? SuchUmami 2 2,221 Aug-16-2023, 02:21 PM
Last Post: snippsat
  Incredible stability of Python code Gribouillis 1 1,621 Jun-25-2023, 10:14 PM
Last Post: Larz60+
  what stand-alone python-aware open-source editors are around? Skaperen 14 5,030 Jun-11-2023, 11:12 PM
Last Post: Skaperen
  Convert Python code to MATLAB code bitoded 4 7,543 Dec-30-2022, 02:06 AM
Last Post: Larz60+
  shortening Python code Skaperen 12 5,904 Oct-23-2022, 10:54 PM
Last Post: Skaperen
  looking for code that substitues parts of python code Skaperen 0 1,710 Jul-07-2022, 11:34 PM
Last Post: Skaperen
  Accessing Python code & SQL datbase from other pc's Extra 1 1,911 Jun-24-2022, 11:30 PM
Last Post: Larz60+
  compiling but not running source code Skaperen 1 2,511 Jun-05-2022, 10:47 PM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020