7

I want do start the python interpreter and debug with sys.argv. I do not want to provide a python file. If I provide a file, the interpreter executes the file and finishes.

Is there a way to archive this?

python argA argB
...
>>> import sys
>>> print sys.argv
['argA','argB']
1
  • use mock's patch function to replace sys.argv with another list. Commented May 2, 2019 at 10:18

1 Answer 1

9

This is pretty much what you want:

$ python - argA argB

The first argument will show up as -, though - think of it as a pseudo script name. I don't think you can get away from that.

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

1 Comment

this might be even better! (does not influence the code I'm debugging if i do copy&paste my "consol-research" into working project!!!)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.