0

I want a script to run an then finish on the python shell with all variables and methods:

$ python myprogram.py

...
program output
...

>>> 

And with #!/usr/bin/python is posible? so I double-click and it just works?

4
  • Why not simply import your module into interpreter? Commented Nov 17, 2015 at 19:40
  • I can do a: python -> import myprogramm, but i want to do it straight away Commented Nov 17, 2015 at 19:41
  • Did you check python --help? Commented Nov 17, 2015 at 19:41
  • #!/usr/bin/python -i is the answer Commented Nov 17, 2015 at 19:49

1 Answer 1

5

Sounds like you want Python's i flag. From the help menu:

-i : inspect interactively after running script; forces a prompt even if stdin does not appear to be a terminal; also PYTHONINSPECT=x

So the full command would be

python -i yourscriptname.py
Sign up to request clarification or add additional context in comments.

1 Comment

bah way better than my suggestion ... how did i not know this after so many years

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.