3

I'm looking to have the same functionality (history, ...) as when you simply type python in your terminal. The script I have goes through a bunch of setup code, and when ready, the user should have a command prompt. What would be the best way to achieve this?

2 Answers 2

9

Either use readline and code the shell behaviour yourself, or simply prepare the environment and drop into IPython.

Sign up to request clarification or add additional context in comments.

2 Comments

Thank for the links, looks promising.
detly's answer is simpler and fits the problem at hand. Thanks for the info, i'll definitely bookmark that.
6

Run the script from the console with python -i. It will go through the commands and drop you in the usual Python console when it's done.

1 Comment

@sharvey - I just found that out myself last week :) Depending on the platform, if you want a desktop launcher you'll need to look up whatever way is necessary to make the terminal program persist.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.