Emacs frozen with message "Loading Compile...Done" - python

I am using emacs to write Python code. However sometimes Emacs gets frozen with the message "Loading Compile...Done" at the bottom of the editor. I won't be able to make changes to the file or execute any commands when this happens.
How can I fix this issue?

Emacs may be in a loop: Typing C-g may get you out of it.

You should check that emacs is actually able to run Python or whichever compiler you are trying to invoke using compilation mode. If it is python try:
Giving the full path to the python executable.
Installing the executable with a path with no spaces especially on windows.

Related

Visual Studio Code Python Terminal more cleaner?

When I run python code in VSC I get this nonsense that I dont need, Is there a way to remove it? The PS C:\Users.. thing
This information in the VS Code terminal is useful information. When we click the run button, it executes the run command in "Terminal", showing us the path of the python used and the path of the executed file, which avoids the confusion of multiple versions of python.
If you want to omit the displayed paths, you could click F5 to debug the file:
(Please use "console": "internalConsole", in launch.json.)
Or use the VS Code extension such as "Code Runner".
Have you tried adding python to system path?
Are you trying to run code like this?
python main.py
This link has the process for adding python to system variable.
https://datatofish.com/add-python-to-windows-path/

In Visual Studio Code, how do I load my python code to a read-print-eval loop?

I am teaching a class that uses VScode.
I am used to teaching using IDLE, and it is very nice for the students to be able to call their defined functions and run snippets of code in a python terminal, for debugging purposes.
In VScode, they I have been unable to do the same in a satisfactory way.
Option1: I can select all code, right click and run selection/line on terminal. This works for small snippets, but I cannot do it for the whole file (even after selecting the whole file with ctrl-A). On linux, this works, but on windows, it does not, unfortunately (and my students use windows)
Option2: I can use the debug console. This requires adding a breakpoint in one of the last lines of the file, and does not offer tab completion. It works, but is less convenient than IDLE.
Option 3: I can also add the commands to run to the bottom of the file (which is a least preferred alternative, given that is forgoes the interativity of the read-print-eval loop).
Is there any better solution? Installing a VScode extension would not be a problem.
Visual Code is just a text editor like your traditional notepad. to run and debug any kind program you need to install the particular extension for the programming language.
In your case you are using python so you need to install the extension of it. the best one is the "Python" which is developed by microsoft itself. go to your extensions manager and install this extension. right click and click "run python file in terminal" and you are all set.
this will run exactly as they run from the idle(which is default IDE provided by python itself) you can enter the arguments from the console itself. according to me this is the best way to run and debug python programs in VScode.
another way is that VScode shows which python version is installed on your computer on the left bottom side, click on it and the programs will use this interpreter.
out of all the ways listed here and many others, the best method is to run the program in the terminal which is the recommend by python itself and many other programmers.
this method is very simple. what you have to do is open up your command prompt and type the path where python.exe is installed and the type the path of the your program as the argument and press enter. you are done !
ex : C:\Python27\python.exe C:\Users\Username\Desktop\my_python_script.py
You can also pass your arguments of your program in the command prompt itself.
if you do not want to type all this and then just use the solution mentioned above.
hope that your query is solved.
regards

how to execute python script on atom on windows

I am using Atom on Windows 10. While setting up Atom on my computer, I created a folder called "beyond basics". Then I created a python file. I installed platform io on Atom. i got a "+" icon on screen. upon clicking that i got a command line. I am trying to execute on that by writing python filename but I am getting an error. Any help is appreciated.
python3 myfile.py
Try typing myfile.py without the python prefix. It may work, as it works for me on Windows 10. Your bubble is covering up an error message that could help use debug. Can you add an edit and tell us the error message? Until then, just try the command without the python prefix.
You should also save before running, as was commented by Denis Fetinin.
If it still doesn't work, try addding python to the env variables. It's a simple process that you can follow here.

Having trouble running python in cmd.

I am a complete noob when it comes to programming. I just downloaded python and I will be using Notepad ++. I have saved a file to my desktop and the file name is test and changed the extension from .txt to .py
So when I go to Notepad ++ and create a program and save it, I go to the cmd prompt making sure I am in my desktop directory and type the following
python test.py
and it tells me that python is not recognized. Any help to fix this problem would be greatly appreciated.
First thing python is indent oriented programing language and it comes with its default editor called IDLE. So if you use notepad++ instead of IDLE it might gives you a syntax error. Second thing for executing python file from command prompt,you need to setup environment variable.Please see below link for setting up environment variable.
https://docs.python.org/2/using/windows.html
You can directly run your program in IDLE without using command prompt. So i would suggest you to use pythons built in editor (IDLE)

How to run a python function from a file using python commandline?

I am using python.exe.
I tried:
C:/myfile.py
python C:/myfile.py
python "C:/myfile.py"
It always says "invalid syntax". The code is this one:
https://github.com/paulnasca/paulstretch_python/blob/master/paulstretch_stereo.py#L150
So not sure if the file has bugs or I am doing something wrong.
Your screenshot shows that you are already in the Python interpreter. Trying to run python again will result in an error. Exit the interpreter by hitting CtrlD. Make sure you have downloaded the complete paulstretch_stereo.py file. Put the file in the same directory as the files you want to process. Then, from the Windows command line, run python paulstretch_stereo.py --help and the program's options should print out.
By the way, make sure you have NumPy and SciPy installed, otherwise the program won't run.
What you get when you run python.exe directly is called the interactive interpreter.
The usual way to run a python module is simply providing it as a command-line option to the python process:
python C:/myfile.py
This command is provided from your command-line, not from the interactive interpreter.

Categories

Resources