python - Program to run another through command prompt -


i not sure if question answerable. in game using colorama features make nice, colorama features work when access python in command prompt, question how can python program run via command prompt, doable or not? have tried installing win32 in python 2 format , using 3.4 getting syntax errors wasnt sure how fix.

i not sure why happening, mean, colorama not working without starting prompt.

perhaps environment variables path or something.

this 1 suggestion, , not sure work not changing window program running in, invoking cmd.exe i.e. command prompt start within , start python , script again.

but worth try:

# start of program: import sys, os  if "started_with_prompt" not in sys.argv:     cmd = 'cmd /c "'+sys.executable+' '+" ".join(sys.argv)+' started_with_prompt"'     os.system(cmd)     sys.exit() print "the rest of program" 

if doesn't work, there tricks can used through subprocess module similar thing. also, should @ cmd.exe's see whether should use other switch /c enable environment and/or registry extensions.

but, essentially, should able same result making shortcut command 1 in cmd variable, or batch file starts python. this:

@echo off cmd /c "c:\python27\python.exe path_to_your_script.py" 

i think both work, somehow wouldn't solution.

well, think shortcut need full path cmd.exe is: c:\windows\system32\cmd.exe

let me know if doesn't work.


Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -