First time here? Check out the FAQ!
1

How to specify a runtime parameter during debugging
 

Hi,

I've gone through the docs, and they seem to indicate that on the Project or Module level, in order to specify runtime arguments that override the default, we have to create a Named Entry Point or just use the Project Settings and specify the module to execute followed by the command line arguments.

My main module is called main.py. The command line parameter I want to use is d:\Projects.

So for example in "Use Project Settings and the Following Run Args", I specified

main.py d:\software,

But when running the app, there's an error

"C:\Program Files\Python313\python.exe: No module named d:\software"

It looks like anything I include as Run Args, are interpreted as modules. There doesn't seem to be a simple dialog box that assumes the project already knows the starting module, and just needs the command line arguments to be sent to the app.

I've tried several different approaches from the documentation, but none of them recognize my parameters as parameters to be input to the calling module.

I tried Youtube, and all it does is show videos about Python command line parameters, not Wing Pro.

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
wpCurious's avatar
81
wpCurious
asked Mar 8

Comments

see more comments

1 Answer

0

To debug a file named main.py with command line arguments "1 2" (without the quotes), open the file and then use Debug Current File from the Debug menu. In the pre-launch dialog box that appears, leave the the top option bar set to Use Project Settings and the Following Run Args, and enter the following in the text field: 1 2

This assumes that you run the script from the command line using python main.py 1 2. Things are more complicated if you use python -m main 1 2 from the command line -- leave a comments if you use python -m, and we'll explain that case.

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
Wingware Support's avatar
4.2k
Wingware Support
answered Mar 8
link

Comments

Yes, "python main.py 1 2" is how I prefer, thanks. Please close the ticket.

wpCurious's avatar wpCurious (Mar 8)
see more comments

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss.

Add Answer

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)