1

I want to open a python file in cmder terminal quickly. Currently, the fastest way i know how is to navigate to the directory of the python file in cmder terminal and then run it by calling "python file.py". This is slow and cumbersome. Is there a way for me to have a file or exe, that, when i run it (or drag the program onto it), automatically makes the program run in cmder straight away.

Windows 10

Clarification: I'm using cmder terminal specifically because it supports text coloring. Windows terminal and powershell do not support this.

Gunty
  • 1,841
  • 1
  • 15
  • 27

2 Answers2

0

On windows you can go to the directory with the file in the explorer and then simply hold shift as you right click at the same time. This will open the menu and there you will have the option to use the command shell/powershell and then you don't have to navigate to the directory inside the shell anymore and can just execute the python file. I hope that helps.

Kim Tang
  • 2,330
  • 2
  • 9
  • 34
  • 1
    The issue is that i dont want to use cmd or terminal. they dont support text colouring which is something i want to use. – Gunty Mar 06 '20 at 10:48
  • Okay, it would help if you could explain the problem in more detail then maybe. I don't fully understand what you want to do. If you don't want to use cmd/terminal, then you are not looking for something that opens the python file in cmd, right? Do you want to execute the file or do you just want to edit it, with highlights for python syntax? – Kim Tang Mar 06 '20 at 10:54
  • i really just want it to be an output window with text coloring functionality. The only thing that it will show is print statements with different asci colours. I dont intend to accept input of any kind. I also dont want to edit the through the terminal. – Gunty Mar 06 '20 at 11:01
  • 1
    If you want to show the print statements of a python script with different coloring, you need to assign them the specific colors, so that each statement etc. will have a defined color. Maybe have a look here and see if that helps: https://stackoverflow.com/questions/287871/how-to-print-colored-text-in-terminal-in-python The colorama module for instance looks helpful for that. – Kim Tang Mar 06 '20 at 11:05
  • thats what im doing, the problem is that the standard windows terminal and powershell terminal dont support this coloring. – Gunty Mar 07 '20 at 01:28
0

Answer: The escape codes just weren't properly configured for the windows terminals. You can get around this by using colorama's colorama.init(). It should work after that.

Gunty
  • 1,841
  • 1
  • 15
  • 27