Is it possible to run a python script with atom, in another window? It may use any package, at long as it works with python 3 and tkinter. I tried the script package, but I couldn't find the option. Is there somebody of you who got it working?
I don't think ATOM is an IDE. It is just an Editor.
It cannot create a Development environment. Your best option is use the built-in "Terminal".
Even if there exist some package, all it could do is execute a command line, which is similar to manually running the file on the command line.
Running Python on Eclipse can give you a feel, that you execute by clicking the "Run", but it masks the command line actually.
Only 'notebook' can do the wonders of python kernel.
Related
How do we run a Python script in Atom editor? Please see screenshot below with errors:
Below I was testing if i can run python in Atom editor. I have also ran the (c:\Anaconda3\Scripts\activate base)command in Anaconda prompt
In your Atom built-in terminal, you are first typing in "python" without any file arguments, and such bringing you into the Python Interactive Prompt, include the name of your file (num.py).
The SyntaxError you're getting is because your trying to run "python num.py" as code instead of a CMD command.
In addition to #HarryKearney answer, there are a number of packages that will easily run scripts. For example, run-in-terminal allows you to press F5 to open a terminal or command prompt window running the python script. Some other options to do similar things are: atom-python-run, atom-runner, script to run code directly in atom and several others you can find in the package repository. Choosing one of these and installing it will probably make it a lot easy if you will be running python scripts frequently.
I am trying to compile a .tex file in a Python script using pdflatex. The command pdflatex filename.tex works when I run it from the command line on Windows. However, attempting to run os.system("pdflatex filename.tex") just spits out 1 into the Python console and does not compile a pdf. I've also tried putting in the full file path similar to this person solved their problem but the same thing happens. Similarly, subprocess.call(['pdflatex', 'filename.tex']) just outputs a 1 and does not do anything.
It seems someone else has encountered the same problem in this thread, but on Mac instead of Windows. (But regardless of the operating system, they didn't find an answer.)
Why might this be happening?
EDIT: I've just discovered a solution. The script runs successfully (using the os.system approach) when I run the .py file using the command line. Previously I was attempting to run the script from RStudio, both using reticulate::source_python(filename) and also line-by-line via the reticulate REPL. Seems like the problem may actually be coming from R's reticulate package rather than anything to do with Python.
Fortunately RStudio has a terminal window so this doesn't end up being too inconvenient!
I would like to use the Atom IDE since it has nice syntax highlighting for python.
However, when I open a .py file in atom, somehow I cannot execute that file in a terminal any more. When I call the .py file in the terminal, instead of the output the terminal returns nothing and the atom window starts blinking as if it is forcefully taking priority.
Is there a way to set atom to only work as an editor and leave the execution of files to the terminal?
You can use the run-in-terminal package.
you need to install additional packages to run python scripts using atom. You can check this Youtube video.
Credit: #Host Promo
My terminal is running python 2 so when I run my python file the program fails.
So basically I am new to programming and trying to create a small python script to help me auto create folders. I also want to give the script to colleges so that they can use it on their systems too.
I know that I can run my file in terminal by using "python3 myfile.py" and it will work, but that's too much off a mission to do for my colleges and as my colleges are not familiar with code or terminal for that matter, I wanted to create an executable file so that they just click to open type a few answers to the promoted question and boom folders created.
This is where I run into a problem, I have "#!/usr/bin/env python3" at the top of my file but when I run the script IDLE opens up and it just shows the code I have written but doesn't seem to run the actual script I wrote. Am I doing something wrong?
I also then though perhaps I could just use the terminal to run the file as it is now executable, so I go into terminal and enter "myfile.py" and the program runs but in python 2 so my script fails as it is in python3. So another question would be is there a way to code into my python file, when running this file make sure you use python3? as I would want this to work on all colleges system without them having to write out anything in terminal?
Sorry for the long explanation but any advice would be greatly appreciated.
Thank you in advance
When you are on windows you can just create a .bat file where you write: python3 myfile.py in it.
Both files have to be in the same directory.
If you want to have a .exe you can also use py2exe.
You could also try just #!/usr/bin/python3 without env.
More here.
I have opened Anaconda - then i maneuvered to the directory where a certain python program i want to run actually lies.
I then tried the %run command.
But the command does not seem to work!
So how am i to run that program?
Does anyone know the right command that one has to use in the black colored Anaconda console command line, to run a Python program existing in a certain directory (to which the command line has been taken to)
%run is a command that's run from inside of IPython. To use it, you should start ipython first. Or just run python program.py (if your program is named program.py).