Hi. I'm new to the pywin32 and COM interfaces. I have a simple task. I want to attach my VisualStudio to current Python process with specific debug engine, to eliminate Python debugging and use only Native C++ code debugging.
Using pywin32 I get DTE object by this: import win32com.client dte = win32com.client.GetActiveObject("VisualStudio.DTE.15.0") Then I look through existing processes and find PID of the current Python process. I want to make something like this: for proc in dte.Debugger.LocalProcesses: if proc.ProcessID == os.getpid(): proc.Attach2("native") break But Attach2 exists only on Process2: https://docs.microsoft.com/en-us/dotnet/api/envdte80.process2.attach2?view=visualstudiosdk-2017 How can I convert/cast Process object to Process2 object? Or in general, how can I convert DTE object to DTE2 object? https://docs.microsoft.com/en-us/dotnet/api/envdte80.dte2?view=visualstudiosdk-2017 Because, when I do win32.CastTo(dte.Debugger, "Debugger2") or win32.CastTo(dte, "DTE2") every time I'm getting this error: ValueError: The interface name 'Debugger2' does not appear in the same library as object '<win32com.gen_py.Microsoft Development Environment 8.0 (Version 7.0 Object Model).Debugger instance at 0x88224584>'
_______________________________________________ python-win32 mailing list python-win32@python.org https://mail.python.org/mailman/listinfo/python-win32