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
  Can you recommend me a vps that will run api python code? SuchUmami 2 1,022 Aug-16-2023, 02:21 PM
Last Post: snippsat
  Visual Studio for Python 357mag 3 64,405 Jul-11-2023, 08:15 AM
Last Post: PyDan
  Incredible stability of Python code Gribouillis 1 694 Jun-25-2023, 10:14 PM
Last Post: Larz60+
  what stand-alone python-aware open-source editors are around? Skaperen 14 2,079 Jun-11-2023, 11:12 PM
Last Post: Skaperen
  Convert Python code to MATLAB code bitoded 4 4,961 Dec-30-2022, 02:06 AM
Last Post: Larz60+
  shortening Python code Skaperen 12 2,457 Oct-23-2022, 10:54 PM
Last Post: Skaperen
  looking for code that substitues parts of python code Skaperen 0 1,192 Jul-07-2022, 11:34 PM
Last Post: Skaperen
  Accessing Python code & SQL datbase from other pc's Extra 1 1,097 Jun-24-2022, 11:30 PM
Last Post: Larz60+
  compiling but not running source code Skaperen 1 1,339 Jun-05-2022, 10:47 PM
Last Post: Gribouillis
  filtering python code the interpreter reads Skaperen 0 1,170 Feb-02-2022, 08:29 PM
Last Post: Skaperen

Forum Jump:

User Panel Messages

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