Viusal studio code can't run any programing language - python

My vscode can't run any code.I've been trying to fix it for 2-3 days now but that doesn't work.I don't know it about I try to setup c/c++ in vscode about 15 days ago that time it work it can c c++ python however this few day I back to code something and have found can't run any code.
can anyone please suggested solutions.I read previous post about this before but it not the same when I try to run code noting happening and no error.
and about python files must call file like this for run and that file must in Drive C.It unlike normal just press F5 or click runcode then it run.
I want to fix it like before.It mean make it to show the result of my code in visual studio.

If you can't run any code inside VSCode it's most likely the lack of needed extensions causing the problem, you can download extensions by going to the extension menu with ctrl + shift + x and if you are connected to the internet, VSCode will show recommended extensions for you.
About the problem that you can't run a python file outside of the C: drive, I think that the anonymity of your python executor to the CMD is causing this problem.
The easiest way to fix it is to uninstall your python executable with its own installer (the setup.exe file which you installed python with, it can uninstall python too) and installing it again with the difference that you must tick the "add to environment variables" option at the beginning of the installation, then you may be able to run the python executable everywhere with this command:
python example.py
After installing c/c++ extension you might want to go to the extension you downloaded and look under the extension name for other c/c++ extensions you want to install too.
To make intellisense and built-in c/c++ code execution work, download Microsoft's c/c++ extension for the best experience.
May this help you!

Trial 1: Try downgrading your vs-code version and check if problem still persists.
Trial 2: Assuming you don't have code runner, Try installing code runner extension in vs-code and use that for running your program

Related

Python error in VSCode :Sorry, something went wrong activating IntelliCode support for Python

My code is not working in vscode when i click to run code i saw this error:
Sorry, something went wrong activating IntelliCode support for Python.
Please check the "Python" and "VS IntelliCode" output windows for
details.
and when i try to run code again i saw this message;
Code is already running
Code dont stop when i click to ctrl+c so i have to close the editor and open it back. I dont understand why this happen , please help me,thanks in advance.
I would just like to add a few helpful links:
Intellicode Issue 57
Intellicode Issue 266
Gitmemory issue 486082039
For a lot of people, it just began working after a few tries randomly. See this text (quoted from issue 57):
There's a race condition in the activation of both the IntelliCode and Python language server extensions. Even if the Python extension is loaded, the language server that the extension spins up might not be fully initialized yet. So if the Python extension loads, then the IntelliCode extension, then the Python language server initializes, we will have this problem.
For some people, it was working to reload VS Intellicode pack following the reinstall the Python extension pack.
Thank you.
Go to Extensions, then search for the Python extension, then switch to release.
Make sure to have Pylance installed (intellisense support for Python)
Make sure to be into the tab for any python file For VS Code, and locate the {} Python icon on the bottom row. Click over the {} icon, and then click over Select Interpreter. Just after that, make sure to input the desired python path, wait for a few seconds in the current python tab, and finally Pylance will be doing its job👌
First of all find your Python installation path
Copy it
Then in VSCode
Open settings
Extensions
Python
Default Interpreter Path
And paste the full path to your Python installation folder.
For example:
X:/Program Files/Python310
If it didn't work immediately, try reloading VSCode.
(P.S. Should work without any reloads)

Shipping Interpreter with Python application

I am new to Python. Please excuse me if my question seems stupid. I have spent a lot of time before posting this.
When I searched for shipping python interpreter with the applications, I found solutions including installing separate applications, using third party modules, etc...
I was thinking of more direct approach: I first install python interpreter on my machine (windows). Then I ship the installed python interpreter (copy and paste the folder) with the pyc file of my application. And finally I create a simple batch program that executes the interpreter and running the pyc file. In this case, the user can simply run the application by simply running the batch program. I have tried it and it worked.
Although this solution seems the most obvious and the easiest one, I am in a doubt about it because I cannot find any one mentioning it. Is there anything wrong with my solution? I usually create desktop applications for windows.
Thanks in advance.
Make a virtual environment for you application and then run run the command python filename.py --onefile --windowed while still being in the virtual env. activated,

Basepath argument is not fully qualified. Parameter name: basePath. I can not use code completion

I just open a .py file on visual-studio-code. And I got a message:Basepath argument is not fully qualified.
Parameter name: basePath. And I can not use python completion. The source of this message is Python(Extension) of Microsoft.
Here is image description
I had the same issue today, and I opened a folder in VSCode(The path of you .py file. You can see the option in your image). It seems that it works for me now. I'm not sure whether it will be helpful to you.
Same thing happened to me, it started today.
I checked my Python install, python path in sys, reinstalled VSCode and no changes.
Im using Python 3.7, win 10.
In the end what solved it for me was in settings.json, in VSCode, set "python.jediEnabled": true and after that VSCode prompted me with a warning that one of the extensions uses the language server (sorry i forgot the name of the extension, it was an old python autocomplete extension), after removing that extension everything was working fine.
As far as i understand it was a problem with the ms language server, jediEnabled setting configures the VSCode to use Jedi as the IntelliSense engine instead of Microsoft Python Language Server, some extensions require ms lang server so if you remove them you should be good.
Give it a try, hope it helps.
I had the same issue yesterday and solved it this afternoon.
The source of this message is also Python(Extension) of Microsoft.
But, and i assume this is maybe the same for you, it was linked to "IntelliCode extension for VS Code (preview)" which asked me to activate pylit.
So the only way i found to repair the software was to delete my preferences files to reset Visual Studio Code and boot like the first time.
Then i re-installed my extensions and preferences.
You do not need to uninstall the soft.
Note that uninstalling Visual Studio Code won't change anything if you don't delete manually the preferences files.
Here how to do it on Windows :
https://filljoyner.com/2018/08/18/how-to-reset-visual-studio-code-on-windows/

Adding Python 2.7 & 3.x Interpreters to PyCharm

I'm having issues adding a project interpreter to PyCharm from a new Anaconda environment. I have Anaconda2 installed with one Python 2.7 environment (C:\Anaconda2\python.exe) that I've been using on Pycharm without issue for several months.
I am attempting to add a second Python 3.6 interpreter (from C:\Anaconda2\envs\py36\python.exe) to my PyCharm. After adding the Local Interpreter to Pycharm, I run into a MS Visual C++ Runtime Error R6034 "An application has made an attempt to load the C runtime library incorrectly".
From cursory googling, it seems that there could be a runtime DLL conflict (potentially msvcr90.dll) between Python 2 & 3. All fixes I see involve editing the executable path of the application, but I don't think this is feasible for my Pycharm use case. How do I get rid of this error, or just generally be able to use both Python 2 & 3 interpreters through my PyCharm?
I think that's the problem with Anaconda and different msvc dll in the computer.
You can test the conda command in the command line, to see if R6034 happens. If it happens, try the following solution:
I had a similar problem with Anaconda3 and Python27. I solved this problem via executing the following command in cmd, outside of any conda environment:
conda install msvc_runtime
After installing the packages, open a new command and test if the R6034 error still appears.
I had a similar issue and was able to resolve it by selecting:
File --> Invalid Caches / Restart...
from PyCharm's main menu.
You may also want to double check that any Conda Environments that you have defined as Python Interpreters in PyCharm are properly configured per the docs
This issue was absolutely maddening. Million R6034 error windows would just keep popping up one after another if I just wanted to get help on a function. I researched it for months, on/off, opened tickets with JetBrains to no avail.
If you need to have multiple versions of Anaconda, and if you have Anaconda paths in your PATH, before launching PyCharm, delete all Anaconda paths from PATH, and then start PyCharm. You need to create a separate wrapper launcher script for PyCharm to fix PATH before PyCharm is started. Note that alternative of starting PyCharm and then fixing interpreter and python console PATHS inside PyCharm do not really work. Because PyCharm may be using a system path to access python to read documentation etc. So the only clean fix is to fix the system PATH before PyCharm starts.
Once you understand what needs to be done, then you can use your own steps/tools. This worked for me:
Create a script that modifies PATH. I used Python for that, sed or any other tools are fine too. The script simply examines each path element and removes it if it refers to Anaconda, and then puts it back together:
path_cleanup.py:
path_old = os.environ['PATH']
path_python_removed = [loc for loc in path_old.split(pathsep) if not ('python' in loc or 'Ana' in loc)]
print(pathsep.join(path_python_removed))
Create Powershell script to fix PATH and start PyCharm from that clean environment. To find PyCharm path, the simplest is to start it up the usual way, and head to Task Manager, right mouse click on pycharm64.exe process and select "open file location" to get the full path.
pycharm_clean.ps1
$Env:Path=python path_cleanup.py # call the script to fix the PATH
start-process $PYCHARM_PATH\pcharm64.exe -WindowStyle Hidden # enter your full path to pycharm and put it into background.
You can create a shortcut to launch pycharm_clean.ps1 + you can add it to your windows start up folder to be launched upon login: %APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup\
If you use BASH inside Cygwin, then steps for path clean up require a bit more tuning, but nothing you cannot do. If you need help, put a comment and I can add that script as well.

How to run python script using atom?

I have been using atom code editor to write C code and run it using a gcc compiler, recently I started out on python code and have been trying to run python script using atom code editor but i keep on getting errors, is there a way to fix this?
Having run C on atom should not interfere with you running python. Make sure you've installed the python extension and you name your file with the py extension. Also, install the 'script' extension. Enter your script and hit command-I. The script extension should then run your script. Command-I is just a shortcut to run script. You can install these extensions (add-ons) by going to Preferences under the Atom menu item. This opens a window in Atom and you can install from a list of available extensions.
Possible you need to change the language selected in the bottom right corner, see here: https://user-images.githubusercontent.com/31619951/31304897-b0900c7e-ab4a-11e7-803c-b34168895ed3.PNGIf still no go, might need to uninstall C++ packages in atom and reinstall atom-gpp-compiler, based on a github support thread I was reading through
If you run atom-python-run and gpp-compiler at the same time it will show you this error.
So disabling gpp-compiler will not show this problem when you want to run Python.
And when you run C then disabling atom-python-run and enable gpp-compiler will solve your problem.
I am a junior and this is the way I have solved my problem, please correct me if there is any mistake.
And if anyone has an easier way, please share.

Categories

Resources