Python open default terminal, execute commands, keep open, AND then allow user-input <p>I'm wanting to open a terminal from a Python script (not one marked as executable, but actually doing python3 myscript.py to run it), have the terminal run commands, and then keep the terminal open and let the user type commands into it.</p> <p>EDIT (as suggested): I am primarily needing this for Linux (I'm using Xubuntu, Ubuntu and stuff like that). It would be really nice to know Windows 7/8 and Mac methods, too, since I'd like a cross-platform solution in the long-run. Input for any system would be appreciated, however.</p> <hr> <p>Just so people know some useful stuff pertaining to this, here's some code that may be difficult to come up with without some research. This doesn't allow user-input, but it does keep the window open. The code is specifically for Linux:</p> <pre><code>import subprocess, shlex; myFilePathString="/home/asdf asdf/file.py"; params=shlex.split('x-terminal-emulator -e bash -c "python3 \''+myFilePathString+'\'; echo \'(Press any key to exit the terminal emulator.)\'; read -n 1 -s"'); subprocess.call(params); </code></pre> <p>To open it with the Python interpreter running afterward, which is about as good, if not better than what I'm looking for, try this:</p> <pre><code>import subprocess, shlex; myFilePathString="/home/asdf asdf/file.py"; params=shlex.split('x-terminal-emulator -e bash -c "python3 -i \''+myFilePathString+'\'"'); subprocess.call(params); </code></pre> <p>I say these examples may take some time to come up with because passing parameters to bash, which is being opened within another command can be problematic without taking a few steps. Plus, you need to know to use to quotes in the right places, or else, for example, if there's a space in your file path, then you'll have problems and might not know why.</p> <p>EDIT: For clarity (and part of the answer), I found out that there's a standard way to do this in Windows:</p> <pre><code>cmd /K [whatever your commands are] </code></pre> <p>So, if you don't know what I mean try that and see what happens. Here's the URL where I found the information: <a href="http://ss64.com/nt/cmd.html" rel="nofollow">http://ss64.com/nt/cmd.html</a></p>