Reputation: 31
With a previous install of Python 2.7 on a Windows 7 machine I could start a script by right-clicking on the filename in windows explorer. Ther was a menu option "Run in interactive mode". By clicking that, a screen would open up, the script would run and.... it would stay open to inspect the output on the screen and do some further actions.
In a fresh install on a Windows 8 machine, this menu option is not present. I can dubble click or Open the file, but then the window closes after running the script.
How can I create the menu entry "Run in interactive mode" when right-clicking on a py file in Windows 8?
I could not find answers in this site or on the Python site.
Upvotes: 3
Views: 4599
Reputation: 997
What you need to do is to add "-i" option when run a python file.
C:\windows\system32>python -i main.py
Then you will go into the interactive mode, where you can print current variables, call functions and so on.
To make it as a right menu, you can add following cotent to Windows Registery.
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Python.File\shell\Run in interactive mode]
[HKEY_CLASSES_ROOT\Python.File\shell\Run in interactive mode\command]
@="\"C:\\Python27\\python.exe\" \"-i\" \"%1\" %*"
Upvotes: 6