Category : visual-studio-code

I have a simple directory structure: proj/ src/ __init__.py foo.py bar.py test/ __init__.py test_foo.py test_foo.py import unittest import sys sys.path.append(‘../src’) from src import foo class TestFoo(unittest.TestCase): def test_foo(self): foo.start() if __name__ == ‘__main__’: unittest.main() foo.py import bar def start(): bar.do_stuff() When running my test (I’m using vscode), I get the following error: Failed to import ..

Read more

I’ve installed Kivy…..a lot of times. I’m in VS Code and it shows in Libraries but I can’t seem to figure out how to import. Getting "kivy module does not exist" error. Can run a .py file with just ‘import kivy’ in the terminal with success. Cannot run kivy built-in example from terminal. ErrNo2. Source: ..

Read more

I used this code in Vs code: import requests from bs4 import BeautifulSoup url = "https://www.gov.uk/search/news-and-communications" reponse = requests.get(url) page = reponse.content soup = BeautifulSoup(page, "html.parser") class_name= "gem-c-document-list__item-link" titres = soup.find_all("a", class_=class_name) titres_textes=[] for titre in titres: titres_textes.append(titre.string) titres_textes But when I try to run it with Ctrl+Alt+N nothing happens ,why ? python versions>3.10 extensions ..

Read more