First time here? Check out the FAQ!
1

How do I set a Launch Configuration to use the -m convention?

I want to launch with...

python.exe -u -m mypackage.mymodule

I understand I can add the -m, but how do I get it to use the proper package.module.

tinjaw's avatar
72
tinjaw
asked 2019-11-25 13:06:54 -0500
Wingware Support's avatar
4k
Wingware Support
updated 2020-01-22 19:31:16 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

3 Answers

0

As of Wing 7.2, you do this with Environment under the Debug/Execute tab in File Properties, or you can set up a Named Entry Point from the Debug menu and select Named Module and enter the module name.

Wingware Support's avatar
4k
Wingware Support
answered 2020-01-22 19:30:16 -0500
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments
1

You can also locate runpy with at any python prompt:

import runpy
print(runpy.__file__)
gadgetsteve's avatar
56
gadgetsteve
answered 2019-11-26 11:54:06 -0500
edit flag offensive 0 remove flag delete link

Comments

@gadgersteve, I just want to check with you that this continues to be true for virtual environments.

Thanks.

tinjaw's avatar tinjaw (2019-11-27 09:46:34 -0500) edit
1

Some quick testing shows that runpy is not copied as a part of the virtual environment for venv nor virtualenv on 2.7 but is on the python path in all of my tests so the above gives the same result both in the virtual environments that I have tested and in normal use.- note that os is copied and gives different results in the venv to normal use so it is working fine!

gadgetsteve's avatar gadgetsteve (2019-11-27 14:16:58 -0500) edit
add a comment see more comments
0

The -m option is not currently supported. We plan to add support for it soon.

Wingware Support's avatar
4k
Wingware Support
answered 2019-11-26 09:26:07 -0500
edit flag offensive 0 remove flag delete link

Comments

What is the suggested workaround? I ask because I have a large main project that I am using to evaluate Wing Pro against, and it requires the use of -m format.

====EDIT====

Let me rephrase that. I know of no other way to run it w/o the -m option. I am open to being schooled.

tinjaw's avatar tinjaw (2019-11-26 11:12:42 -0500) edit
1

A workaround is to use runpy.py in the standard library as the main debug file and specify the module name as the first argument -- so to debug the equivalent of python -m pip, the arguments for runpy.py would be: pip

To easily find runpy.py, add import runpy to a file and then use goto definition on runpy.

Wingware Support's avatar Wingware Support (2019-11-26 11:43:32 -0500) edit
add a comment 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