Category : visual-studio-code

I want to generate a query to remove data from my database, but I get the following error- TypeError: not all arguments have been converted during string formatting. Where am I going wrong? def delete(name): conn = psycopg2.connect(dbname="postgres", user="postgres", password="password", host="localhost", port="5432") cursor = conn.cursor() query = ”’DELETE FROM products WHERE name IN {%s} ”’ ..

Read more

suppose I have the following script: import argparse parser = argparse.ArgumentParser() parser.add_argument(‘-t’,’–text’, help="Input a text") args = parser.parse_args() def test_function(x): y = x print(y) if __name__ == ‘__main__’: test_function(args.text) which I call from the console with python newtest.py -t hello Question: In Visual Code, is there a way that I can execute the code from ..

Read more

I’ve attempted to work a bit more in WSL recently (I’ve got the most up-to-date version of WSL2 and the Windows 11 insider beta, both of which I updated today) Everything works great! But plotly has been giving me issues. When I run it from within VSCode (making sure Python Interpreter is set to my ..

Read more

I installed Visual Code fresh and installed Python 3. In VSC I added matplotlib using pip install matplotlib Which now gives me this result PS Z:phyton> pip install matplotlib Requirement already satisfied: matplotlib in c:usersmatthappdatalocalpackagespythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0localcachelocal-packagespython39site-packages (3.5.1) Requirement already satisfied: cycler>=0.10 in c:usersmatthappdatalocalpackagespythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0localcachelocal-packagespython39site-packages (from matplotlib) (0.11.0) Requirement already satisfied: python-dateutil>=2.7 in c:usersmatthappdatalocalpackagespythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0localcachelocal-packagespython39site-packages (from matplotlib) (2.8.2) Requirement ..

Read more

whenever I try to import matplotlib or matplotlib.pyplot in VS Code I get the error in the title: Import "matplotlib" could not be resolved from source Pylance(reportMissingModuleSource) or Import "matplotlib.pyplot" could not be resolved from source Pylance(reportMissingModuleSource) The hyperlink of the reportMissingModuleSource sends me to https://github.com/microsoft/pylance-release/blob/main/DIAGNOSTIC_SEVERITY_RULES.md#diagnostic-severity-rules, where it says: "Diagnostics for imports that have no ..

Read more

I have a folder structure as └── project ├── package1 │ ├── module1.py │ └── module2.py └── package2 ├── __init__.py └── module3.py From module1.py I can currently import something from module3.py with from package2.module3 import abc. However I want to alias package2 as something else without changing the name of the folder so that I ..

Read more