AnswerBun.com

Moving from Geany to Sublime Text 3: how to run Python scripts in command prompt?

Super User Asked on January 1, 2022

I’ve been coding in Python 3.6 using the Geany editor for a while. When I run scripts in Geany, a Windows command prompt running Python will pop up and run the script. This I did using the build command python -i "%f" in Geany.

Now I’ve been trying out a different editor: Sublime Text 3. However, I find the in-built console doesn’t work well for my needs, so as with Geany I’d like a Windows command prompt to pop up and run my code. How do I do this in Sublime Text 3?

One Answer

Try this thing out: You might have created the python file in some directory just double click on it. There is one issue with this once the program ends the CMD window closes so try to give enough delay so that you could verify your output like this:

import time

and put the following as your last line

time.sleep(seconds) # put 120 like that i.e. 2 minutes it will wait before closing CMD

Or try this Open CMD and open the directory to your python file using cd to change directory, e: or d: to choose drive cd.. to go back by one step to the parent directory if directed to your directory

python thefile.py

will open the python file with the name thefile.py if the file is on desktop just type python thefile.py in the cmd.

Answered by Kamalesh Pathy on January 1, 2022

Add your own answers!

Related Questions

Dreamweaver hangs when opening or viewing a file

2  Asked on December 11, 2020 by kallum-tanton

       

Import passwords from Firefox to LastPass

2  Asked on December 10, 2020 by noamtm

     

UPS vs PSU wattage during normal operation?

0  Asked on December 9, 2020 by mike-lasch

     

USB MIDI keyboard losing events on Windows 10

0  Asked on December 9, 2020 by mikhail-ramendik

     

Preparing a ZFS based setup for a potential future upgrade

0  Asked on December 9, 2020 by trinity-1686a

   

Add a new disk as mirroring (raid 1) to existing disk

1  Asked on December 9, 2020 by user13727833

       

ClamAV exclude on some signature does not work

0  Asked on December 9, 2020 by kalib-zen

 

Windows 10 keeps opening apps on its own

0  Asked on December 9, 2020 by karlabos

     

Can I know how vice uses .vkm files

0  Asked on December 8, 2020 by cody-ferguson

 

Disable internal speaker only on Windows 10 Dell

2  Asked on December 8, 2020 by fire-lancer

     

Why my CPU never work on the maximum multiplier

1  Asked on December 8, 2020 by notrust

 

Selective counting up in Excel

1  Asked on December 8, 2020 by nm82

 

Ask a Question

Get help from others!

© 2023 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP