Advice / RTFM needed for tool setup to participate in python development from a Windows host

Hello, I hope this is the correct place to ask this question. I have a desire to participate in python development in a particular area from my Windows host machine, but I am not finding any concise listing of the tool setup needed to fully participate, nor any detailed guidance on how to proceed when underlying code debugging is necessary. I do know that some version of the MS VS20xx suite is necessary to begin. My initial attempts using the VS2019 Community Edition have been less than successful when it comes to debugging an underlying C library component when the starting program is python because I have not figured out how to use the VS2019 environment to do that. So I would appreciate any RTFM / URL that can guide me in starting to participate, especially for guidance on debugging procedures for underlying C components when the initial program is a python script. I have read most of the "Python Developers Guide" material, but there is not any Window-specific tooling information that I have seen there yet. What other tooling do I need besides a VS20xx environment? I do have good experience in C programming, but not much in using VS20xx IDE's. TIA for your gentle guidance in curing my ignorance. Peter

Personally, I just have Visual Studio and VS Code as my text editor. I rarely use Visual Studio directly, though, I mostly use the `build.bat` and similar scripts in the `PCBuild` directory. Having said that, I'm not doing anything like debugging problems with DLLs, for which I imagine a decent C development environment is needed. You don't have much choice other than Visual Studio there (no other compiler is supported on Windows), though, so you'll probably need to learn that. Paul On Wed, 16 Dec 2020 at 18:28, <pjfarley3@earthlink.net> wrote:
Hello,
I hope this is the correct place to ask this question. I have a desire to participate in python development in a particular area from my Windows host machine, but I am not finding any concise listing of the tool setup needed to fully participate, nor any detailed guidance on how to proceed when underlying code debugging is necessary.
I do know that some version of the MS VS20xx suite is necessary to begin. My initial attempts using the VS2019 Community Edition have been less than successful when it comes to debugging an underlying C library component when the starting program is python because I have not figured out how to use the VS2019 environment to do that.
So I would appreciate any RTFM / URL that can guide me in starting to participate, especially for guidance on debugging procedures for underlying C components when the initial program is a python script.
I have read most of the "Python Developers Guide" material, but there is not any Window-specific tooling information that I have seen there yet. What other tooling do I need besides a VS20xx environment?
I do have good experience in C programming, but not much in using VS20xx IDE's.
TIA for your gentle guidance in curing my ignorance.
Peter _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-leave@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/LIGWZ43L... Code of Conduct: http://python.org/psf/codeofconduct/

On 2020-12-16 19:19, Paul Moore wrote:
Personally, I just have Visual Studio and VS Code as my text editor. I rarely use Visual Studio directly, though, I mostly use the `build.bat` and similar scripts in the `PCBuild` directory.
Having said that, I'm not doing anything like debugging problems with DLLs, for which I imagine a decent C development environment is needed. You don't have much choice other than Visual Studio there (no other compiler is supported on Windows), though, so you'll probably need to learn that.
Paul
FWIW, I debug the regex module in Visual Studio 2019 Community. I compile a release build with optimisations turned off when I'm going to be single-stepping through the code, otherwise it's very confusing with it jumping around all over the place due to the optimisations it's done.
On Wed, 16 Dec 2020 at 18:28, <pjfarley3@earthlink.net> wrote:
Hello,
I hope this is the correct place to ask this question. I have a desire to participate in python development in a particular area from my Windows host machine, but I am not finding any concise listing of the tool setup needed to fully participate, nor any detailed guidance on how to proceed when underlying code debugging is necessary.
I do know that some version of the MS VS20xx suite is necessary to begin. My initial attempts using the VS2019 Community Edition have been less than successful when it comes to debugging an underlying C library component when the starting program is python because I have not figured out how to use the VS2019 environment to do that.
So I would appreciate any RTFM / URL that can guide me in starting to participate, especially for guidance on debugging procedures for underlying C components when the initial program is a python script.
I have read most of the "Python Developers Guide" material, but there is not any Window-specific tooling information that I have seen there yet. What other tooling do I need besides a VS20xx environment?
I do have good experience in C programming, but not much in using VS20xx IDE's.
TIA for your gentle guidance in curing my ignorance.
Peter

Yes, that is my specific issue. I have a C DLL invoked by a python wrapper module using ctypes that has at least one issue (and likely more than one) so I need to be able to start a python test script and debug the lower-level DLL code. The C test programs for the lower-level C DLL all seen to succeed, so I am suspecting something is wrong in the wrapper code. If anyone has or knows of step-by-step instructions on how to set that debug environment up and start the outer-level script with debug breakpoints in the DLL I would greatly appreciate it. I'm also doing my own searches for tutorials on debugging python with VS20xx, but have not read/viewed one of those yet. I have in fact been able to re-compile cpython and the lower-level DLL using the VS2019 command line tools, but so far my only debugging capability has been to insert fprintf's to a trace file in the lower-level DLL code (or macros that result in such output) into the C code where I *think* the problem is happening, but I have not been able to nail it down yet. Being able to start the process from the IDE and catch any C errors when they happen would be ideal. My environment is Win10-64 and python 3.8.5. Peter
-----Original Message----- From: Paul Moore <p.f.moore@gmail.com> Sent: Wednesday, December 16, 2020 2:20 PM To: pjfarley3@earthlink.net Cc: Python Dev <python-dev@python.org> Subject: Re: [Python-Dev] Advice / RTFM needed for tool setup to participate in python development from a Windows host
Personally, I just have Visual Studio and VS Code as my text editor. I rarely use Visual Studio directly, though, I mostly use the `build.bat` and similar scripts in the `PCBuild` directory.
Having said that, I'm not doing anything like debugging problems with DLLs, for which I imagine a decent C development environment is needed. You don't have much choice other than Visual Studio there (no other compiler is supported on Windows), though, so you'll probably need to learn that.
Paul
On Wed, 16 Dec 2020 at 18:28, <pjfarley3@earthlink.net> wrote:
Hello,
I hope this is the correct place to ask this question. I have a desire to participate in python development in a particular area from my Windows host machine, but I am not finding any concise listing of the tool setup needed to fully participate, nor any detailed guidance on how to proceed when underlying code debugging is necessary.
I do know that some version of the MS VS20xx suite is necessary to begin. My initial attempts using the VS2019 Community Edition have been less than successful when it comes to debugging an underlying C library component
when
the starting program is python because I have not figured out how to use the VS2019 environment to do that.
So I would appreciate any RTFM / URL that can guide me in starting to participate, especially for guidance on debugging procedures for underlying C components when the initial program is a python script.
I have read most of the "Python Developers Guide" material, but there is not any Window-specific tooling information that I have seen there yet. What other tooling do I need besides a VS20xx environment?
I do have good experience in C programming, but not much in using VS20xx IDE's.
TIA for your gentle guidance in curing my ignorance.
Peter --

Even if Python itself is the standard distribution, you should be able to debug your outside DLL module in VS just by putting a breakpoint on your favorite line and setting "/path/to/python.exe -m yourmodule" as the command path under debugging in your project properties, or whatever commandline accomplishes whatever initialization you need to test. Multiprocessing might be something else entirely, I don't know, I've only debugged DLLs in-process. As soon as your breakpoint is hit, it'll stop as you'd expect, even though you started something else entirely. -Em On Wed, Dec 16, 2020 at 4:56 PM <pjfarley3@earthlink.net> wrote:
Yes, that is my specific issue. I have a C DLL invoked by a python wrapper module using ctypes that has at least one issue (and likely more than one) so I need to be able to start a python test script and debug the lower-level DLL code. The C test programs for the lower-level C DLL all seen to succeed, so I am suspecting something is wrong in the wrapper code.
If anyone has or knows of step-by-step instructions on how to set that debug environment up and start the outer-level script with debug breakpoints in the DLL I would greatly appreciate it. I'm also doing my own searches for tutorials on debugging python with VS20xx, but have not read/viewed one of those yet.
I have in fact been able to re-compile cpython and the lower-level DLL using the VS2019 command line tools, but so far my only debugging capability has been to insert fprintf's to a trace file in the lower-level DLL code (or macros that result in such output) into the C code where I *think* the problem is happening, but I have not been able to nail it down yet. Being able to start the process from the IDE and catch any C errors when they happen would be ideal.
My environment is Win10-64 and python 3.8.5.
Peter
-----Original Message----- From: Paul Moore <p.f.moore@gmail.com> Sent: Wednesday, December 16, 2020 2:20 PM To: pjfarley3@earthlink.net Cc: Python Dev <python-dev@python.org> Subject: Re: [Python-Dev] Advice / RTFM needed for tool setup to participate in python development from a Windows host
Personally, I just have Visual Studio and VS Code as my text editor. I rarely use Visual Studio directly, though, I mostly use the `build.bat` and similar scripts in the `PCBuild` directory.
Having said that, I'm not doing anything like debugging problems with DLLs, for which I imagine a decent C development environment is needed. You don't have much choice other than Visual Studio there (no other compiler is supported on Windows), though, so you'll probably need to learn that.
Paul
On Wed, 16 Dec 2020 at 18:28, <pjfarley3@earthlink.net> wrote:
Hello,
I hope this is the correct place to ask this question. I have a
participate in python development in a particular area from my Windows host machine, but I am not finding any concise listing of the tool setup needed to fully participate, nor any detailed guidance on how to proceed when underlying code debugging is necessary.
I do know that some version of the MS VS20xx suite is necessary to begin. My initial attempts using the VS2019 Community Edition have been less
desire to than
successful when it comes to debugging an underlying C library component when the starting program is python because I have not figured out how to use the VS2019 environment to do that.
So I would appreciate any RTFM / URL that can guide me in starting to participate, especially for guidance on debugging procedures for underlying C components when the initial program is a python script.
I have read most of the "Python Developers Guide" material, but there is not any Window-specific tooling information that I have seen there yet. What other tooling do I need besides a VS20xx environment?
I do have good experience in C programming, but not much in using VS20xx IDE's.
TIA for your gentle guidance in curing my ignorance.
Peter --
Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-leave@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/H4MZYLFF... Code of Conduct: http://python.org/psf/codeofconduct/

Thank you Emily! That may allow me to do what I need to do to find the error(s) lurking there. No multi-processing is involved in my current project, so it should be more straightforward to accomplish the debugging I need to do. Peter From: Emily Bowman <silverbacknet@gmail.com> Sent: Wednesday, December 16, 2020 8:11 PM To: pjfarley3@earthlink.net Cc: Python Dev <python-dev@python.org> Subject: Re: [Python-Dev] Re: Advice / RTFM needed for tool setup to participate in python development from a Windows host Even if Python itself is the standard distribution, you should be able to debug your outside DLL module in VS just by putting a breakpoint on your favorite line and setting "/path/to/python.exe -m yourmodule" as the command path under debugging in your project properties, or whatever commandline accomplishes whatever initialization you need to test. Multiprocessing might be something else entirely, I don't know, I've only debugged DLLs in-process. As soon as your breakpoint is hit, it'll stop as you'd expect, even though you started something else entirely. -Em On Wed, Dec 16, 2020 at 4:56 PM <pjfarley3@earthlink.net <mailto:pjfarley3@earthlink.net> > wrote: Yes, that is my specific issue. I have a C DLL invoked by a python wrapper module using ctypes that has at least one issue (and likely more than one) so I need to be able to start a python test script and debug the lower-level DLL code. The C test programs for the lower-level C DLL all seen to succeed, so I am suspecting something is wrong in the wrapper code. If anyone has or knows of step-by-step instructions on how to set that debug environment up and start the outer-level script with debug breakpoints in the DLL I would greatly appreciate it. I'm also doing my own searches for tutorials on debugging python with VS20xx, but have not read/viewed one of those yet. I have in fact been able to re-compile cpython and the lower-level DLL using the VS2019 command line tools, but so far my only debugging capability has been to insert fprintf's to a trace file in the lower-level DLL code (or macros that result in such output) into the C code where I *think* the problem is happening, but I have not been able to nail it down yet. Being able to start the process from the IDE and catch any C errors when they happen would be ideal. My environment is Win10-64 and python 3.8.5. Peter
-----Original Message----- From: Paul Moore <p.f.moore@gmail.com <mailto:p.f.moore@gmail.com> > Sent: Wednesday, December 16, 2020 2:20 PM To: pjfarley3@earthlink.net <mailto:pjfarley3@earthlink.net> Cc: Python Dev <python-dev@python.org <mailto:python-dev@python.org> > Subject: Re: [Python-Dev] Advice / RTFM needed for tool setup to participate in python development from a Windows host
Personally, I just have Visual Studio and VS Code as my text editor. I rarely use Visual Studio directly, though, I mostly use the `build.bat` and similar scripts in the `PCBuild` directory.
Having said that, I'm not doing anything like debugging problems with DLLs, for which I imagine a decent C development environment is needed. You don't have much choice other than Visual Studio there (no other compiler is supported on Windows), though, so you'll probably need to learn that.
Paul
On Wed, 16 Dec 2020 at 18:28, <pjfarley3@earthlink.net <mailto:pjfarley3@earthlink.net> > wrote:
Hello,
I hope this is the correct place to ask this question. I have a desire to participate in python development in a particular area from my Windows host machine, but I am not finding any concise listing of the tool setup needed to fully participate, nor any detailed guidance on how to proceed when underlying code debugging is necessary.
I do know that some version of the MS VS20xx suite is necessary to begin. My initial attempts using the VS2019 Community Edition have been less than successful when it comes to debugging an underlying C library component
when
the starting program is python because I have not figured out how to use the VS2019 environment to do that.
So I would appreciate any RTFM / URL that can guide me in starting to participate, especially for guidance on debugging procedures for underlying C components when the initial program is a python script.
I have read most of the "Python Developers Guide" material, but there is not any Window-specific tooling information that I have seen there yet. What other tooling do I need besides a VS20xx environment?
I do have good experience in C programming, but not much in using VS20xx IDE's.
TIA for your gentle guidance in curing my ignorance.
Peter --
Python-Dev mailing list -- python-dev@python.org <mailto:python-dev@python.org> To unsubscribe send an email to python-dev-leave@python.org <mailto:python-dev-leave@python.org> https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/H4MZYLFF... Code of Conduct: http://python.org/psf/codeofconduct/

On 16Dec2020 2114, pjfarley3@earthlink.net wrote:
If anyone has or knows of step-by-step instructions on how to set that debug environment up and start the outer-level script with debug breakpoints in the DLL I would greatly appreciate it. I'm also doing my own searches for tutorials on debugging python with VS20xx, but have not read/viewed one of those yet.
Hi Peter Hopefully this document is able to help you get set up: https://docs.microsoft.com/en-us/visualstudio/python/debugging-mixed-mode-c-... It gives you a few options, depending on whether you've created a Python project, a C++ project, or are attaching to a running process. Hopefully one of those will suit you. There are some videos out there as well, but they're a little older. (If you don't see Python projects, you'll need to go back to the Visual Studio installer, select the Python workload and the Python Native Development option.) If you run into problems, there's a "Report a problem" (under Help/Send Feedback) inside VS that will get directly to the team, though most people are on vacation for the next few weeks. (And yes, "the official docs aren't good enough for me to follow" is a problem ;) ) Cheers, Steve

Thanks for that link Steve. I will read it and see what it can help me do. It does seem like it is pretty much on target for the scenario I have, which is a C DLL project that is invoked by python wrapper functions invoked from a python script. Peter
-----Original Message----- From: Steve Dower <steve.dower@python.org> Sent: Thursday, December 17, 2020 5:22 AM To: pjfarley3@earthlink.net; 'Python Dev' <python-dev@python.org> Subject: Re: [Python-Dev] Re: Advice / RTFM needed for tool setup to participate in python development from a Windows host
On 16Dec2020 2114, pjfarley3@earthlink.net wrote:
If anyone has or knows of step-by-step instructions on how to set that debug environment up and start the outer-level script with debug breakpoints in the DLL I would greatly appreciate it. I'm also doing my own searches for tutorials on debugging python with VS20xx, but have not read/viewed one of those yet.
Hi Peter
Hopefully this document is able to help you get set up: https://docs.microsoft.com/en-us/visualstudio/python/debugging-mixed-mode- c-cpp-python-in-visual-studio?view=vs-2019
It gives you a few options, depending on whether you've created a Python project, a C++ project, or are attaching to a running process. Hopefully one of those will suit you. There are some videos out there as well, but they're a little older. (If you don't see Python projects, you'll need to go back to the Visual Studio installer, select the Python workload and the Python Native Development option.)
If you run into problems, there's a "Report a problem" (under Help/Send Feedback) inside VS that will get directly to the team, though most people are on vacation for the next few weeks. (And yes, "the official docs aren't good enough for me to follow" is a problem ;) )
Cheers, Steve
participants (5)
-
Emily Bowman
-
MRAB
-
Paul Moore
-
pjfarley3@earthlink.net
-
Steve Dower