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.
Related
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
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)
I am trying to learn to code by reading through simple python project, and
there is one thing I quite do not understand.
Pardon me if the question was not phrased correctly, I am not sure how to phrase otherwise ...
IN the Getting started instruction, the part "run python installer",
What does installer refer here? does it refer to the installer folder in the directory or some pre-defined python commands?
Also, if it refers to the installer folder in the directory, how is that running any executable, since it is the folder, not any particular file????
I would really appreciate if anyone could help. Thank you
PS. https://github.com/sukeesh/Jarvis
is the link of the github project I Was reading through.
When it means python installer, it means the exe that installs python for you which you can get here depending on which version you want.
You may run your python code via anaconda prompt which u can get here also u can download your python library to the anaconda navigator
You also edit your code using Pycharm code editor
Hello everyone and thanks for reading. Today I tried to open a python script with Atom but it doesn't recognize that it is written in Python. Also even if a make a new script and save it as .py the problem insists. Not recognizing it as python script doesn't allow Atom to change colors of fonts or suggest words when programming etc, but I can still run the script normally through cmd.. Atom just displays it as plain text. What is even more weird is that when I click the button (bottom right of Atom's IDE) which opens up the available language formats, I can see everything (Auto Detection, Plain Text, Java, C, ...) other than Python.. Atom IDE can't find python
I run Windows 10 64bit, I have python 3.6.3 (checked the path already and seems it is working since I can see the version through cmd), I have also downloaded pip, sklearn
Now for Atom, I have only installed 3 packages, which are all for running scripts through Atom (atom-runner, platform-ide-terminal, script). I have already reinstalled both Atom & Python. Note that I also have version 2 python in my computer, but haven't linked a path to my laptop's systems variables so I guess it is not an issue.
I would really appreciate any suggestions, I am stuck here 1 day now and I don't want to switch Atom for anything else.
"It has nothing to do with Python itself. The language-python Atom package does the syntax highlighting and some other things in Atom. It's a core package, so it should be installed by default. Can you try apm enable language-python?" from user: anothernode
This solved my issued
I have a small program written with Python3 that I'd like to install on friends computers. The main issue is that not every computer has a Python3 installed on it (mostly Python2-). Do I have to install it on each computer I want my program to run?
I thought it would be possible to install Python3 inside a separate directory, as shown below.
Then, I would be able to use a shebang to run the right version of Python installed inside myProgram folder.
#!C:\myProgram\python3 python
# Test
a = input('Entrer un nom:')
print(a)
When I double-click on myProgram.py file, a window opens and closes immediatly...
Is this a bad idea or not? Is there a way to achieve that differetnly if so?
You could create an executable from the python script rather than installing all of python 3 on their machine. There's a few ways you can do it, see this answer.
I'd have a look at pyinstaller.
Add Python 3 to your friends machine to execute your program.
What'is the utility to run such a small program on their computers?
The way you propose won't work.
Windows does not know about shebangs.
Even if it did, this one would only work if a user installed the program to C:\myProgram (which is not a really appropriate place, and the user might not have the rights to install it there).
There are ways to make a python program portable w/o having the need to have a Python runtime installed. Alas, I currently don't know their name.
Or, if that is feasible, install Python 3 on their machines, but I don't know if that might break any programs wanting to use Python 2.
There're different tools which can pack you program to single .exe file or make an installer. Here's my solution from 2016 year - Python - create an EXE that runs code as written, not as it was when compiled
Now it will be little easier :)