3

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.

1
  • I'd appreciate this, too! Not necessarily the menu entry - any possibility would be interesting, to stop inside a script without releasing the variables from memory, so that I can examine them Commented Apr 25, 2016 at 15:05

1 Answer 1

6

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\" %*"
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.