Not sure how to go about an issue I have. I execute my code in through command line in format:
python program.py arg1 arg2
Which is fine in most cases, but I just got iPython and I want to launch the code in iPython to use it for debugging. However, I cant find the best way to pass arguments.
executable('program') isn't sufficient for this
and kind of having trouble with subprocess, cant make it work
subprocess.call([sys.executable, 'program.py','arg1'])
You should be able to just run ipython program.py arg1 arg2. If you then want to interact with the program after the script runs, do ipython -i program.py arg1 arg2. The -i flag works the same for ipython as it does for python.
If you are already inside ipython and want to run your script, you can use the ipython magic function to run a script with run program.py arg1 arg2. You also use the -m option with the run function, and it will work similar to the -m option on regular python to run a module by name rather than a script path.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With