From isjoshreally at gmail.com Wed Jan 4 07:30:39 2017 From: isjoshreally at gmail.com (Josh collins) Date: Wed, 4 Jan 2017 12:30:39 +0000 Subject: [python-win32] Scripting AutoCAD Message-ID: Hello community, please help if you can! I'm adapting a script that I found online here . I'm trying to change it so that it can open a document, and then change it. Here's what I have: import win32com.client acad = win32com.client.DispatchEx("AutoCAD.Application") acad.Visible = True doc = acad.Documents.Open("*path*") # Document object # iterate trough all objects (entities) in the currently opened drawing # and if its a BlockReference, display its attributes and some other things. for entity in acad.Database.Blocks: name = entity.EntityName if name == 'AcDbBlockReference': HasAttributes = entity.HasAttributes if HasAttributes: for attrib in entity.GetAttributes(): string = str(attrib.TextString) print(entity.Name) print(entity.Layer) print(entity.ObjectID) print(" {}: {}".format(attrib.TagString, attrib.TextString)) #update text attrib.TextString = "success!" attrib.Update() I'm getting the error attached. Does anybody know where I'm going wrong? Thanks, Josh -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: error.jpg Type: image/jpeg Size: 14145 bytes Desc: not available URL: From chuck.fowler at hpe.com Sat Jan 7 14:16:09 2017 From: chuck.fowler at hpe.com (Fowler, Charles E (HP OneView - Ft. Collins)) Date: Sat, 7 Jan 2017 19:16:09 +0000 Subject: [python-win32] problem installing pywin with Python 3.6 Message-ID: Hello, I am new to the list, and relatively new to Python development in general. That said, I need to be able to use the win32com module and I am encountering issues installing it and using it. I have installed the 32-bit version of Python 3.6, which I verified at the Python cli. When I try to install the 32-bit version of pywin (build 220, pywin32-220.win32-py3.6.exe) the installer yells at me saying it can't find a compatible version of Python. If, however, I try to install the 64-bit version of build 220 (pywin32-220.win-amd64-py3.6.exe) the install succeeds fine. But, when I try to import win32com I get the standard error trying to load a DLL, which indicates it is trying to load the wrong version of the DLL, where I have 32-bit Python 3.6 but am trying to load the 64-bit DLL. I must be doing something wrong here, but I can't see what it is. Any help would be appreciated. Thank you -------------- next part -------------- An HTML attachment was scrubbed... URL: From 2281570025 at qq.com Sun Jan 8 00:41:58 2017 From: 2281570025 at qq.com (=?ISO-8859-1?B?aU1hdGg=?=) Date: Sun, 8 Jan 2017 13:41:58 +0800 Subject: [python-win32] some shellcon constants have not been implemented yet ? Message-ID: some shellcon constants have not been implemented yet ? >>> from win32com.shell import shell, shellcon >>> shellcon.WPSTYLE_STRETCH 2 >>> shellcon.WPSTYLE_KEEPASPECT Traceback (most recent call last): File "", line 1, in shellcon.WPSTYLE_KEEPASPECT AttributeError: module 'win32com.shell.shellcon' has no attribute 'WPSTYLE_KEEPASPECT' >>> shellcon.WPSTYLE_CENTER 0 >>> shellcon.WPSTYLE_TILE 1 >>> shellcon.WPSTYLE_MAX 3 >>> shellcon.WPSTYLE_CROPTOFIT Traceback (most recent call last): File "", line 1, in shellcon.WPSTYLE_CROPTOFIT AttributeError: module 'win32com.shell.shellcon' has no attribute 'WPSTYLE_CROPTOFIT' >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Sun Jan 8 03:26:13 2017 From: timr at probo.com (Tim Roberts) Date: Sun, 8 Jan 2017 00:26:13 -0800 Subject: [python-win32] problem installing pywin with Python 3.6 In-Reply-To: References: Message-ID: On Jan 7, 2017, at 11:16 AM, Fowler, Charles E (HP OneView - Ft. Collins) > wrote: I am new to the list, and relatively new to Python development in general. That said, I need to be able to use the win32com module and I am encountering issues installing it and using it. I have installed the 32-bit version of Python 3.6, which I verified at the Python cli. When I try to install the 32-bit version of pywin (build 220, pywin32-220.win32-py3.6.exe) the installer yells at me saying it can?t find a compatible version of Python. If, however, I try to install the 64-bit version of build 220 (pywin32-220.win-amd64-py3.6.exe) the install succeeds fine. That suggests rather strongly that you did NOT install the 32-bit version of Python. Can you cut-and-paste the header lines when you start the command line? ? Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. -------------- next part -------------- An HTML attachment was scrubbed... URL: From chuck at ftcfowlers.net Sun Jan 8 09:51:19 2017 From: chuck at ftcfowlers.net (chuck at ftcfowlers.net) Date: Sun, 8 Jan 2017 07:51:19 -0700 Subject: [python-win32] problem installing pywin with Python 3.6 In-Reply-To: References: Message-ID: <00cf01d269be$b1ffcdc0$15ff6940$@ftcfowlers.net> Thank you for looking into this Tim. My initial thought was the same as your hunch. Below is the header CLI output C:\windows\system32>python Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 07:18:10) [MSC v.1900 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> When I try to install pywin32-220.win32-py3.6.exe I get an error dialog indicating Python 3.6 is required but not found in the registry. However, I can successfully install pywin32-220.win32-amd64-py3.6.exe. But, of course I then get the runtime error when trying to load a DLL. It seems like the pywin32 install is getting confused when trying to detect the version of Python I have, somehow mixing up 32 and 64 bit. The version of Python I have was published on 12/23, so it is only a couple weeks old. Is it possible something changed in the latest Python release causing this install issue? Thank you, Chuck Fowler From: python-win32 [mailto:python-win32-bounces+chuck=ftcfowlers.net at python.org] On Behalf Of Tim Roberts Sent: Sunday, January 8, 2017 1:26 AM To: python-win32 at python.org Subject: Re: [python-win32] problem installing pywin with Python 3.6 On Jan 7, 2017, at 11:16 AM, Fowler, Charles E (HP OneView - Ft. Collins) > wrote: I am new to the list, and relatively new to Python development in general. That said, I need to be able to use the win32com module and I am encountering issues installing it and using it. I have installed the 32-bit version of Python 3.6, which I verified at the Python cli. When I try to install the 32-bit version of pywin (build 220, pywin32-220.win32-py3.6.exe) the installer yells at me saying it can?t find a compatible version of Python. If, however, I try to install the 64-bit version of build 220 (pywin32-220.win-amd64-py3.6.exe) the install succeeds fine. That suggests rather strongly that you did NOT install the 32-bit version of Python. Can you cut-and-paste the header lines when you start the command line? ? Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. -------------- next part -------------- An HTML attachment was scrubbed... URL: From webguy at totalrewind.com Sun Jan 8 22:50:24 2017 From: webguy at totalrewind.com (Kurt Eilander) Date: Sun, 8 Jan 2017 20:50:24 -0700 Subject: [python-win32] What does pythoncom interface look like? Message-ID: Hey all, I'm trying to create a win32com server that implements a standard interface (IExtractImage) I've added the iid to _com_interfaces_ and the method names to _public_methods_, but now I'm at a complete loss how to implement them. For instance, given the method, HRESULT IExtractImage::GetLocation( [out] LPWSTR pszPathBuffer, [in] DWORD cchMax, [out] DWORD *pdwPriority, [in]const SIZE *prgSize, [in] DWORD dwRecClrDepth, [in, out] DWORD *pdwFlags ); How in the world is that supposed to look as a python method?? (Or is there some c++ or other glue I'd need to write to define that?) Thanks, -K -------------- next part -------------- An HTML attachment was scrubbed... URL: From burrows at preveil.com Mon Jan 9 03:25:39 2017 From: burrows at preveil.com (Aaron Burrow) Date: Mon, 9 Jan 2017 03:25:39 -0500 Subject: [python-win32] automatically restart python service after crash Message-ID: I developed a python service using win32serviceutil.ServiceFramework and PythonService.exe. If the service crashes (eg, an unhandled exception is raised) I want the service to restart. So, I configured the service to restart using `ChangeServiceConfig2`. Code looks like this. ``` import win32serviceutil import win32service import os from . import makeWin32Service win32serviceutil.HandleCommandLine(makeWin32Service.PreVeilService) service_name = os.environ.get("PV_SERVICE_NAME") win32service.ChangeServiceConfig2 hscm = win32service.OpenSCManager(None,None,win32service.SC_MANAGER_ALL_ACCESS) try: hs = win32service.OpenService(hscm, service_name, win32service.SERVICE_ALL_ACCESS) try: win32service.ChangeServiceConfig2(hs, win32service.SERVICE_CONFIG_FAILURE_ACTIONS_FLAG, True) service_failure_actions = { 'ResetPeriod': 60*60, # Time in seconds after which to reset the failure count to zero. 'RebootMsg': u'', # Not using reboot option 'Command': u'', # Not using run-command option 'Actions': [ (win32service.SC_ACTION_RESTART, 1000*5), # first action after failure, delay in ms (win32service.SC_ACTION_RESTART, 1000*5), # second action after failure (win32service.SC_ACTION_NONE, 0) # subsequent actions after failure ] } win32service.ChangeServiceConfig2(hs, win32service.SERVICE_CONFIG_FAILURE_ACTIONS, service_failure_actions) except (win32service.error, NotImplementedError): print "ChangeServiceConfig2 failed to set restart behavior" finally: win32service.CloseServiceHandle(hs) finally: win32service.CloseServiceHandle(hscm) ``` This does not work with vanilla pywin32. From the MSDN page for `SERVICE_CONFIG_FAILURE_ACTIONS_FLAG`: "If this member [fFailureActionsOnNonCrashFailures] is TRUE and the service has configured failure actions, the failure actions are queued if the service process terminates without reporting a status of SERVICE_STOPPED or if it enters the SERVICE_STOPPED state but the dwWin32ExitCode member of the SERVICE_STATUS structure is not ERROR_SUCCESS (0). If this member is FALSE and the service has configured failure actions, the failure actions are queued only if the service terminates without reporting a status of SERVICE_STOPPED. This setting is ignored unless the service has configured failure actions. For information on configuring failure actions, see ChangeServiceConfig2." In order for the process to restart PythonService.exe needs to NOT set status to SERVICE_STOPPED or set dwWin32ExitCode to some non zero value. These conditions are not met in PythonService.cpp: ``` void WINAPI service_main(DWORD dwArgc, LPTSTR *lpszArgv) { // ... start = PyObject_GetAttrString(instance, "SvcRun"); if (start==NULL) ReportPythonError(E_PYS_NO_RUN_METHOD); else { // Call the Python service entry point - when this returns, the // service has stopped! PyObject *result = PyObject_CallObject(start, NULL); if (result==NULL) ReportPythonError(E_PYS_START_FAILED); else Py_DECREF(result); } // We are all done. cleanup: // try to report the stopped status to the service control manager. Py_XDECREF(start); Py_XDECREF(instance); if (pe && pe->sshStatusHandle) { // Wont be true if debugging. if (!SetServiceStatus( pe->sshStatusHandle, &stoppedStatus )) ReportAPIError(PYS_E_API_CANT_SET_STOPPED); } return; } ``` Presumably we should do something with the return value from `SvcRun` then conditionally report an error with dwWin32ExitCode. Here is my patch that gives restarts when `SvcRun` throws an exception. The ability to let Windows handle service restarts is important; I would like to get this fixed in upstream. ``` --- win32/src/PythonService.cpp 2017-01-07 14:58:48.156762600 -0500 +++ win32/src/PythonService.cpp 2017-01-09 03:11:08.821727300 -0500 @@ -144,6 +144,15 @@ 0, // dwCheckPoint; 5000 }; +SERVICE_STATUS stoppedErrorStatus = { + SERVICE_WIN32_OWN_PROCESS, + SERVICE_STOPPED, + 0, // dwControlsAccepted, + ERROR_SERVICE_SPECIFIC_ERROR, // dwWin32ExitCode; + 1, // dwServiceSpecificExitCode; + 0, // dwCheckPoint; + 5000 }; + SERVICE_STATUS startingStatus = { SERVICE_WIN32_OWN_PROCESS, SERVICE_START_PENDING, @@ -916,9 +925,13 @@ // Call the Python service entry point - when this returns, the // service has stopped! PyObject *result = PyObject_CallObject(start, NULL); - if (result==NULL) + if (result==NULL) { ReportPythonError(E_PYS_START_FAILED); - else + if (pe && pe->sshStatusHandle) { // Wont be true if debugging. + SetServiceStatus( pe->sshStatusHandle, &stoppedErrorStatus ); + pe->sshStatusHandle = 0; // reset so we don't attempt to set 'stopped' + } + } else Py_DECREF(result); } // We are all done. ``` From Chris.Helvig at dsvolition.com Mon Jan 9 12:00:21 2017 From: Chris.Helvig at dsvolition.com (Chris Helvig) Date: Mon, 9 Jan 2017 17:00:21 +0000 Subject: [python-win32] Problem building pywin32 for Python 3.5 on VS2015 with Windows SDK 10 Message-ID: <2dacb453a2764a13aa3fca90a0ca1371@voliexmb02.dsvolition.com> Update on this. I finally stumbled across the following webpage: http://around-the-corner.typepad.com/adn/2014/10/building-pywin32-for-motionbuilder-2015.html So I just plowed ahead with changing variable names and commenting stuff out until it worked. This was 3 weeks ago now, though. Looking through the changelist, here were things that I changed. AXDebug.cpp: Commented out MachineDebugManager stuff. // PYCOM_INTERFACE_FULL (MachineDebugManager), // PYCOM_INTERFACE_CLSID_ONLY (MachineDebugManager), // @const axdebug|CLSID_MachineDebugManager|An IID object Changed EX_DBGPROP_INFO_* to EX_PROP_INFO_* In AXDebug\src\stdafx.h, I changed: #if defined(__REQUIRED_RPCNDR_H_VERSION__) To : #if 0 In PyIMAPISession.cpp, in PyIMAPISession::Advise(PyObject *self, PyObject *args), I changed: unsigned long connection; To: ULONG_PTR connection; In PyIMAPITable.cpp, I switched: _result = (HRESULT )_swig_self->Advise(_arg0,_arg1,_arg2); To: _result = (HRESULT )_swig_self->Advise(_arg0,_arg1,reinterpret_cast(_arg2)); And: _result = (HRESULT )_swig_self->CreateBookmark(_arg0); To: _result = (HRESULT )_swig_self->CreateBookmark(reinterpret_cast(_arg0)); And from win32job.i, I commented out: #define JOB_OBJECT_RESERVED_LIMIT_VALID_FLAGS JOB_OBJECT_RESERVED_LIMIT_VALID_FLAGS In setup.py, I commented out: // %(mapi)s/PyIExchangeManageStore.i %(mapi)s/PyIExchangeManageStore.cpp As well as everything in the code block starting with: WinExt_win32com('shell', libraries='shell32', pch_header="shell_pch.h", ________________________________ This e-mail may contain CONFIDENTIAL AND PROPRIETARY INFORMATION and/or PRIVILEGED AND CONFIDENTIAL COMMUNICATION intended solely for the recipient and, therefore, may not be retransmitted to any party outside of the recipient's organization without the prior written consent of the sender. If you have received this e-mail in error please notify the sender immediately by telephone or reply e-mail and destroy the original message without making a copy. Deep Silver, Inc. accepts no liability for any losses or damages resulting from infected e-mail transmissions and viruses in e-mail attachments. -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Mon Jan 9 14:14:17 2017 From: timr at probo.com (Tim Roberts) Date: Mon, 9 Jan 2017 11:14:17 -0800 Subject: [python-win32] What does pythoncom interface look like? In-Reply-To: References: Message-ID: Kurt Eilander wrote: > I'm trying to create a win32com server that implements a standard > interface (IExtractImage) > > I've added the iid to _com_interfaces_ and the method names to > _public_methods_, but now I'm at a complete loss how to implement them. > > For instance, given the method, > HRESULT IExtractImage::GetLocation( > [out] LPWSTR pszPathBuffer, > [in] DWORD cchMax, > [out] DWORD *pdwPriority, > [in] const SIZE *prgSize, > [in] DWORD dwRecClrDepth, > [in, out] DWORD *pdwFlags > ); > > How in the world is that supposed to look as a python method?? > > (Or is there some c++ or other glue I'd need to write to define that?) You have four input parameters and three output parameters. You will have something like: def GetLocation( cchMax, prgSize, dwRecClrDepth, dwFlags ): # ... return (S_OK, path, priority, dwFlags) Much experimentation will be required. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From kevin_miller at capgroup.com Tue Jan 10 12:31:15 2017 From: kevin_miller at capgroup.com (Kevin Miller) Date: Tue, 10 Jan 2017 17:31:15 +0000 Subject: [python-win32] Trying to set tab stops in Visio shape Message-ID: <03C43DEBC3335C4D9C65B46508B5A58C1EC2358D@SNX1VBMLS001.cguser.capgroup.com> In Visio, I am trying to set a tab stop in a text box that doesn't have any tabs. I'm running Window 7, Viso 2013, and Python 2.7.10. ----------------- import win32com.client from win32com.client import constants win32com.client.gencache.EnsureDispatch("Visio.Application") visapp = win32com.client.Dispatch("Visio.Application") doc = visapp.Documents.Add("") page = visapp.ActivePage s1 = page.DrawRectangle(1.0, 8.5, 3.75, 9.75) s1.Text = "this\tis\ta\ttest" s1.CellsSRC(constants.visSectionTab, 0, constants.visTabStopCount).FormulaU = "1" s1.CellsSRC(constants.visSectionTab, 0, constants.visTabPos).FormulaU = "0.7 in" s1.CellsSRC(constants.visSectionTab, 0, constants.visTabAlign).FormulaU = "0" s1.CellsSRC(constants.visSectionTab, 0, 3).FormulaU = "0" ----------------- But the tab shows up as UNKNOWN_TOKEN_0 Some posts say that I need to set the RowType first. s1.RowType(constants.visSectionTab, constants.visRowTab) = 151 where 151 is visTagTab10, but this gets an error: SyntaxError: can't assign to function call I hope you can help. ____________________________________________ Kevin Miller (949) 705-2926 / x52926 -------------- next part -------------- An HTML attachment was scrubbed... URL: From public.avatar at gmail.com Mon Jan 16 01:21:13 2017 From: public.avatar at gmail.com (Oleksii Shevchuk) Date: Mon, 16 Jan 2017 08:21:13 +0200 Subject: [python-win32] Possilbly PyWin32/IOCP issue Message-ID: <8737gjo78m.fsf@gmail.com> Hi! I wrote a small sample program ("distributed" proxy server) using asyncoro (https://github.com/pgiri/asyncoro) library. When I try to use it on Windows (tried with 7/10 32/64) I observe python (2.7.12/2.7.13) interpreter crash in GC (always in derefs). It doesn't matter is GC disabled (with gc.disable) or not, crashes always happen after some time in objects cleanup. Why I wrote this message here. AsynCoro uses pywin32 for IOCP bindings. (https://github.com/pgiri/asyncoro/blob/master/py2/asyncoro/__init__.py#L917) When I use AsynCoro with python.select backend I don't meet these problems. So I wrote a bug to the author of the library (https://github.com/pgiri/asyncoro/issues/10), but looks like he (like me) a Linux guy, and see and use these APIs first time. So I write mail here, maybe somebody can give us advice how to resolve this situation. A bit more details. Sample program is here: https://gist.github.com/alxchk/482055c284dc3289f1b61b843908c2af To reproduce I use next steps: 1. rpyc_classic on Linux host 2. asyncoroproxy-test.py runned on Windows host 3. Firefox + Socks5 proxy walks via asyncoroproxy from Windows host 4. Open several sites simultaneously (and youtube among them) It's interesting, that in reverse direction (Socket server on linux, exit point on windows) I can't get a crash. So a difference may be in 1. Firefox closes sockets in some unusual way (whatever this means) 2. Some issues with AcceptEx 3. Some issues with cancelation WSASend/WSARecv Crash callstack example: 0:005> k # Child-SP RetAddr Call Site 00 00000000`03e7efc0 00000000`778a1edf python27!BaseException_dealloc+0x16 [c:\build27\cpython\objects\exceptions.c @ 83] 01 00000000`03e7eff0 00000000`778e84ce python27!tupledealloc+0xcf [c:\build27\cpython\objects\tupleobject.c @ 222] 02 00000000`03e7f020 00000000`778eca11 python27!PyEval_EvalFrameEx+0xa4e [c:\build27\cpython\python\ceval.c @ 2483] 03 00000000`03e7f130 00000000`77877038 python27!PyEval_EvalCodeEx+0x911 [c:\build27\cpython\python\ceval.c @ 3584] 04 00000000`03e7f1e0 00000000`77842d23 python27!function_call+0x178 [c:\build27\cpython\objects\funcobject.c @ 528] 05 00000000`03e7f260 00000000`778ee8eb python27!PyObject_Call+0x83 [c:\build27\cpython\objects\abstract.c @ 2548] 06 00000000`03e7f290 00000000`778eb573 python27!ext_do_call+0x2eb [c:\build27\cpython\python\ceval.c @ 4666] 07 00000000`03e7f2f0 00000000`778ee178 python27!PyEval_EvalFrameEx+0x3af3 [c:\build27\cpython\python\ceval.c @ 3031] 08 00000000`03e7f400 00000000`778ee02f python27!fast_function+0xc8 [c:\build27\cpython\python\ceval.c @ 4438] 09 00000000`03e7f470 00000000`778eb49b python27!call_function+0x3af [c:\build27\cpython\python\ceval.c @ 4372] 0a 00000000`03e7f4d0 00000000`778ee178 python27!PyEval_EvalFrameEx+0x3a1b [c:\build27\cpython\python\ceval.c @ 2993] 0b 00000000`03e7f5e0 00000000`778ee02f python27!fast_function+0xc8 [c:\build27\cpython\python\ceval.c @ 4438] 0c 00000000`03e7f650 00000000`778eb49b python27!call_function+0x3af [c:\build27\cpython\python\ceval.c @ 4372] 0d 00000000`03e7f6b0 00000000`778eca11 python27!PyEval_EvalFrameEx+0x3a1b [c:\build27\cpython\python\ceval.c @ 2993] 0e 00000000`03e7f7c0 00000000`77877038 python27!PyEval_EvalCodeEx+0x911 [c:\build27\cpython\python\ceval.c @ 3584] 0f 00000000`03e7f870 00000000`77842d23 python27!function_call+0x178 [c:\build27\cpython\objects\funcobject.c @ 528] 10 00000000`03e7f8f0 00000000`778575d9 python27!PyObject_Call+0x83 [c:\build27\cpython\objects\abstract.c @ 2548] 11 00000000`03e7f920 00000000`77842d23 python27!instancemethod_call+0x219 [c:\build27\cpython\objects\classobject.c @ 2603] 12 00000000`03e7fba0 00000000`778edb41 python27!PyObject_Call+0x83 [c:\build27\cpython\objects\abstract.c @ 2548] 13 00000000`03e7fbd0 00000000`7780cb1e python27!PyEval_CallObjectWithKeywords+0x141 [c:\build27\cpython\python\ceval.c @ 4222] 14 00000000`03e7fc00 00000000`77931405 python27!t_bootstrap+0x9e [c:\build27\cpython\modules\threadmodule.c @ 621] 15 00000000`03e7fc30 00000000`77c72fdf python27!bootstrap+0x35 [c:\build27\cpython\python\thread_nt.h @ 124] 16 00000000`03e7fc60 00000000`77c73080 MSVCR90!_callthreadstartex+0x17 [f:\dd\vctools\crt_bld\self_64_amd64\crt\src\threadex.c @ 348] 17 00000000`03e7fc90 00007ff9`6ebe8364 MSVCR90!_threadstartex+0x84 [f:\dd\vctools\crt_bld\self_64_amd64\crt\src\threadex.c @ 326] 18 00000000`03e7fcc0 00007ff9`6f1570d1 KERNEL32!BaseThreadInitThunk+0x14 19 00000000`03e7fcf0 00000000`00000000 ntdll!RtlUserThreadStart+0x21 static void BaseException_dealloc(PyBaseExceptionObject *self) { _PyObject_GC_UNTRACK(self); <<<--- HERE BaseException_clear(self); Py_TYPE(self)->tp_free((PyObject *)self); } This trace was with gc.set_threshold(0) Without disabled gc, it will die during garbage collection: 0:005> k # Child-SP RetAddr Call Site 00 00000000`04bfd250 00000000`778a4fc8 python27!visit_decref+0x6 [c:\build27\cpython\modules\gcmodule.c @ 360] 01 00000000`04bfd280 00000000`777dcf08 python27!subtype_traverse+0x78 [c:\build27\cpython\objects\typeobject.c @ 845] 02 00000000`04bfd2d0 00000000`777de2a0 python27!collect+0x1e8 [c:\build27\cpython\modules\gcmodule.c @ 925] 03 00000000`04bfd370 00000000`778a1ab8 python27!_PyObject_GC_Malloc+0x120 [c:\build27\cpython\modules\gcmodule.c @ 1512] 04 00000000`04bfd3a0 00000000`778ee438 python27!PyTuple_New+0x158 [c:\build27\cpython\objects\tupleobject.c @ 90] 05 00000000`04bfd3d0 00000000`778edef9 python27!load_args+0x18 [c:\build27\cpython\python\ceval.c @ 4521] 06 00000000`04bfd400 00000000`778eb49b python27!call_function+0x279 [c:\build27\cpython\python\ceval.c @ 4352] 07 00000000`04bfd460 00000000`778eca11 python27!PyEval_EvalFrameEx+0x3a1b [c:\build27\cpython\python\ceval.c @ 2993] 08 00000000`04bfd570 00000000`77877038 python27!PyEval_EvalCodeEx+0x911 [c:\build27\cpython\python\ceval.c @ 3584] 09 00000000`04bfd620 00000000`77842d23 python27!function_call+0x178 [c:\build27\cpython\objects\funcobject.c @ 528] 0a 00000000`04bfd6a0 00000000`77799d33 python27!PyObject_Call+0x83 [c:\build27\cpython\objects\abstract.c @ 2548] 0b 00000000`04bfd6d0 00000000`77842d23 python27!partial_call+0x73 [c:\build27\cpython\modules\_functoolsmodule.c @ 198] 0c 00000000`04bfd700 00000000`778ee5ab python27!PyObject_Call+0x83 [c:\build27\cpython\objects\abstract.c @ 2548] 0d 00000000`04bfd730 00000000`778ee045 python27!do_call+0x11b [c:\build27\cpython\python\ceval.c @ 4569] 0e 00000000`04bfd770 00000000`778eb49b python27!call_function+0x3c5 [c:\build27\cpython\python\ceval.c @ 4374] 0f 00000000`04bfd7d0 00000000`778eca11 python27!PyEval_EvalFrameEx+0x3a1b [c:\build27\cpython\python\ceval.c @ 2993] 10 00000000`04bfd8e0 00000000`77877038 python27!PyEval_EvalCodeEx+0x911 [c:\build27\cpython\python\ceval.c @ 3584] 11 00000000`04bfd990 00000000`77842d23 python27!function_call+0x178 [c:\build27\cpython\objects\funcobject.c @ 528] 12 00000000`04bfda10 00000000`778575d9 python27!PyObject_Call+0x83 [c:\build27\cpython\objects\abstract.c @ 2548] 13 00000000`04bfda40 00000000`77842d23 python27!instancemethod_call+0x219 [c:\build27\cpython\objects\classobject.c @ 2603] 14 00000000`04bfdcc0 00000000`778ee5ab python27!PyObject_Call+0x83 [c:\build27\cpython\objects\abstract.c @ 2548] 15 00000000`04bfdcf0 00000000`778ee045 python27!do_call+0x11b [c:\build27\cpython\python\ceval.c @ 4569] 16 00000000`04bfdd30 00000000`778eb49b python27!call_function+0x3c5 [c:\build27\cpython\python\ceval.c @ 4374] 17 00000000`04bfdd90 00000000`778ee178 python27!PyEval_EvalFrameEx+0x3a1b [c:\build27\cpython\python\ceval.c @ 2993] 18 00000000`04bfdea0 00000000`778ee02f python27!fast_function+0xc8 [c:\build27\cpython\python\ceval.c @ 4438] 19 00000000`04bfdf10 00000000`778eb49b python27!call_function+0x3af [c:\build27\cpython\python\ceval.c @ 4372] 1a 00000000`04bfdf70 00000000`778eca11 python27!PyEval_EvalFrameEx+0x3a1b [c:\build27\cpython\python\ceval.c @ 2993] 1b 00000000`04bfe080 00000000`77877038 python27!PyEval_EvalCodeEx+0x911 [c:\build27\cpython\python\ceval.c @ 3584] 1c 00000000`04bfe130 00000000`77842d23 python27!function_call+0x178 [c:\build27\cpython\objects\funcobject.c @ 528] 1d 00000000`04bfe1b0 00000000`778575d9 python27!PyObject_Call+0x83 [c:\build27\cpython\objects\abstract.c @ 2548] 1e 00000000`04bfe1e0 00000000`77842d23 python27!instancemethod_call+0x219 [c:\build27\cpython\objects\classobject.c @ 2603] 1f 00000000`04bfe460 00000000`778ee8eb python27!PyObject_Call+0x83 [c:\build27\cpython\objects\abstract.c @ 2548] 20 00000000`04bfe490 00000000`778eb573 python27!ext_do_call+0x2eb [c:\build27\cpython\python\ceval.c @ 4666] 21 00000000`04bfe4f0 00000000`778eca11 python27!PyEval_EvalFrameEx+0x3af3 [c:\build27\cpython\python\ceval.c @ 3031] 22 00000000`04bfe600 00000000`77877038 python27!PyEval_EvalCodeEx+0x911 [c:\build27\cpython\python\ceval.c @ 3584] 23 00000000`04bfe6b0 00000000`77842d23 python27!function_call+0x178 [c:\build27\cpython\objects\funcobject.c @ 528] 24 00000000`04bfe730 00000000`778575d9 python27!PyObject_Call+0x83 [c:\build27\cpython\objects\abstract.c @ 2548] 25 00000000`04bfe760 00000000`77842d23 python27!instancemethod_call+0x219 [c:\build27\cpython\objects\classobject.c @ 2603] 26 00000000`04bfe9e0 00000000`778b0390 python27!PyObject_Call+0x83 [c:\build27\cpython\objects\abstract.c @ 2548] 27 00000000`04bfea10 00000000`778a4d76 python27!slot_tp_init+0xd0 [c:\build27\cpython\objects\typeobject.c @ 5807] 28 00000000`04bfea40 00000000`77842d23 python27!type_call+0xd6 [c:\build27\cpython\objects\typeobject.c @ 765] 29 00000000`04bfea70 00000000`778ee5ab python27!PyObject_Call+0x83 [c:\build27\cpython\objects\abstract.c @ 2548] 2a 00000000`04bfeaa0 00000000`778ee045 python27!do_call+0x11b [c:\build27\cpython\python\ceval.c @ 4569] 2b 00000000`04bfeae0 00000000`778eb49b python27!call_function+0x3c5 [c:\build27\cpython\python\ceval.c @ 4374] 2c 00000000`04bfeb40 00000000`778eca11 python27!PyEval_EvalFrameEx+0x3a1b [c:\build27\cpython\python\ceval.c @ 2993] 2d 00000000`04bfec50 00000000`778ee1e9 python27!PyEval_EvalCodeEx+0x911 [c:\build27\cpython\python\ceval.c @ 3584] 2e 00000000`04bfed00 00000000`778ee02f python27!fast_function+0x139 [c:\build27\cpython\python\ceval.c @ 4451] 2f 00000000`04bfed70 00000000`778eb49b python27!call_function+0x3af [c:\build27\cpython\python\ceval.c @ 4372] 30 00000000`04bfedd0 00000000`7787773c python27!PyEval_EvalFrameEx+0x3a1b [c:\build27\cpython\python\ceval.c @ 2993] 31 00000000`04bfeee0 00000000`778ede8d python27!gen_send_ex+0x12c [c:\build27\cpython\objects\genobject.c @ 86] 32 00000000`04bfef20 00000000`778eb49b python27!call_function+0x20d [c:\build27\cpython\python\ceval.c @ 4340] 33 00000000`04bfef80 00000000`778eca11 python27!PyEval_EvalFrameEx+0x3a1b [c:\build27\cpython\python\ceval.c @ 2993] 34 00000000`04bff090 00000000`77877038 python27!PyEval_EvalCodeEx+0x911 [c:\build27\cpython\python\ceval.c @ 3584] 35 00000000`04bff140 00000000`77842d23 python27!function_call+0x178 [c:\build27\cpython\objects\funcobject.c @ 528] 36 00000000`04bff1c0 00000000`778ee8eb python27!PyObject_Call+0x83 [c:\build27\cpython\objects\abstract.c @ 2548] 37 00000000`04bff1f0 00000000`778eb573 python27!ext_do_call+0x2eb [c:\build27\cpython\python\ceval.c @ 4666] 38 00000000`04bff250 00000000`778ee178 python27!PyEval_EvalFrameEx+0x3af3 [c:\build27\cpython\python\ceval.c @ 3031] 39 00000000`04bff360 00000000`778ee02f python27!fast_function+0xc8 [c:\build27\cpython\python\ceval.c @ 4438] 3a 00000000`04bff3d0 00000000`778eb49b python27!call_function+0x3af [c:\build27\cpython\python\ceval.c @ 4372] 3b 00000000`04bff430 00000000`778ee178 python27!PyEval_EvalFrameEx+0x3a1b [c:\build27\cpython\python\ceval.c @ 2993] 3c 00000000`04bff540 00000000`778ee02f python27!fast_function+0xc8 [c:\build27\cpython\python\ceval.c @ 4438] 3d 00000000`04bff5b0 00000000`778eb49b python27!call_function+0x3af [c:\build27\cpython\python\ceval.c @ 4372] 3e 00000000`04bff610 00000000`778eca11 python27!PyEval_EvalFrameEx+0x3a1b [c:\build27\cpython\python\ceval.c @ 2993] 3f 00000000`04bff720 00000000`77877038 python27!PyEval_EvalCodeEx+0x911 [c:\build27\cpython\python\ceval.c @ 3584] 40 00000000`04bff7d0 00000000`77842d23 python27!function_call+0x178 [c:\build27\cpython\objects\funcobject.c @ 528] 41 00000000`04bff850 00000000`778575d9 python27!PyObject_Call+0x83 [c:\build27\cpython\objects\abstract.c @ 2548] 42 00000000`04bff880 00000000`77842d23 python27!instancemethod_call+0x219 [c:\build27\cpython\objects\classobject.c @ 2603] 43 00000000`04bffb00 00000000`778edb41 python27!PyObject_Call+0x83 [c:\build27\cpython\objects\abstract.c @ 2548] 44 00000000`04bffb30 00000000`7780cb1e python27!PyEval_CallObjectWithKeywords+0x141 [c:\build27\cpython\python\ceval.c @ 4222] 45 00000000`04bffb60 00000000`77931405 python27!t_bootstrap+0x9e [c:\build27\cpython\modules\threadmodule.c @ 621] 46 00000000`04bffb90 00000000`77c72fdf python27!bootstrap+0x35 [c:\build27\cpython\python\thread_nt.h @ 124] 47 00000000`04bffbc0 00000000`77c73080 MSVCR90!_callthreadstartex+0x17 [f:\dd\vctools\crt_bld\self_64_amd64\crt\src\threadex.c @ 348] 48 00000000`04bffbf0 00007ff9`6ebe8364 MSVCR90!_threadstartex+0x84 [f:\dd\vctools\crt_bld\self_64_amd64\crt\src\threadex.c @ 326] 49 00000000`04bffc20 00007ff9`6f1570d1 KERNEL32!BaseThreadInitThunk+0x14 4a 00000000`04bffc50 00000000`00000000 ntdll!RtlUserThreadStart+0x21 static int visit_decref(PyObject *op, void *data) { assert(op != NULL); if (PyObject_IS_GC(op)) { <<--- HERE PyGC_Head *gc = AS_GC(op); /* We're only interested in gc_refs for objects in the * generation being collected, which can be recognized * because only they have positive gc_refs. */ assert(gc->gc.gc_refs != 0); /* else refcount was too small */ if (gc->gc.gc_refs > 0) gc->gc.gc_refs--; } return 0; } 0:005> dv op op = 0x00000000`77a9a6c0 0:005> dx -r1 (*((python27!_object *)0x77a9a6c0)) (*((python27!_object *)0x77a9a6c0)) [Type: _object] [+0x000] ob_refcnt : 61836288 [Type: __int64] [+0x008] ob_type : 0x3ae6378 [Type: _typeobject *] 0:005> dx -r1 (*((python27!_typeobject *)0x3ae6378)) (*((python27!_typeobject *)0x3ae6378)) [Type: _typeobject] [+0x000] ob_refcnt : 2007606976 [Type: __int64] [+0x008] ob_type : 0x3a28588 [Type: _typeobject *] [+0x010] ob_size : 1 [Type: __int64] [+0x018] tp_name : 0x1 : "--- memory read error at address 0x00000000`00000001 ---" [Type: char *] [+0x020] tp_basicsize : 2007389472 [Type: __int64] [+0x028] tp_itemsize : 1 [Type: __int64] [+0x030] tp_dealloc : 0x2f85b60 [Type: void (__cdecl*)(_object *)] [+0x038] tp_print : 0x3b03250 [Type: int (__cdecl*)(_object *,_iobuf *,int)] [+0x040] tp_getattr : 0x3aec8b0 [Type: _object * (__cdecl*)(_object *,char *)] [+0x048] tp_setattr : 0x1 [Type: int (__cdecl*)(_object *,char *,_object *)] [+0x050] tp_compare : 0x1 [Type: int (__cdecl*)(_object *,_object *)] [+0x058] tp_repr : 0x37c4fe8 [Type: _object * (__cdecl*)(_object *)] [+0x060] tp_as_number : 0x3b03268 [Type: PyNumberMethods *] [+0x068] tp_as_sequence : 0x0 [Type: PySequenceMethods *] [+0x070] tp_as_mapping : 0x3b9a650 [Type: PyMappingMethods *] [+0x078] tp_hash : 0x3ace060 [Type: long (__cdecl*)(_object *)] [+0x080] tp_call : 0x1 [Type: _object * (__cdecl*)(_object *,_object *,_object *)] [+0x088] tp_str : 0x1 [Type: _object * (__cdecl*)(_object *)] [+0x090] tp_getattro : 0x77a65520 [Type: _object * (__cdecl*)(_object *,_object *)] [+0x098] tp_setattro : 0x1 [Type: int (__cdecl*)(_object *,_object *,_object *)] [+0x0a0] tp_as_buffer : 0x3ace078 [Type: PyBufferProcs *] [+0x0a8] tp_flags : 61798576 [Type: long] [+0x0b0] tp_doc : 0x3ab19b0 : " d???" [Type: char *] [+0x0b8] tp_traverse : 0x1 [Type: int (__cdecl*)(_object *,int (__cdecl*)(_object *,void *),void *)] [+0x0c0] tp_clear : 0x1 [Type: int (__cdecl*)(_object *)] [+0x0c8] tp_richcompare : 0x38001f8 [Type: _object * (__cdecl*)(_object *,_object *,int)] [+0x0d0] tp_weaklistoffset : 61798600 [Type: __int64] [+0x0d8] tp_iter : 0x0 [Type: _object * (__cdecl*)(_object *)] [+0x0e0] tp_iternext : 0x3aecbe0 [Type: _object * (__cdecl*)(_object *)] [+0x0e8] tp_methods : 0x3ab12f0 [Type: PyMethodDef *] [+0x0f0] tp_members : 0x1 [Type: PyMemberDef *] [+0x0f8] tp_getset : 0x1 [Type: PyGetSetDef *] [+0x100] tp_base : 0x38001f8 [Type: _typeobject *] [+0x108] tp_dict : 0x3aecbf8 [Type: _object *] [+0x110] tp_descr_get : 0x0 [Type: _object * (__cdecl*)(_object *,_object *,_object *)] [+0x118] tp_descr_set : 0x3b03030 [Type: int (__cdecl*)(_object *,_object *,_object *)] [+0x120] tp_dictoffset : 61740688 [Type: __int64] [+0x128] tp_init : 0x1 [Type: int (__cdecl*)(_object *,_object *,_object *)] [+0x130] tp_alloc : 0x1 [Type: _object * (__cdecl*)(_typeobject *,__int64)] [+0x138] tp_new : 0x37c4fe8 [Type: _object * (__cdecl*)(_typeobject *,_object *,_object *)] [+0x140] tp_free : 0x3b03048 [Type: void (__cdecl*)(void *)] [+0x148] tp_is_gc : 0x0 [Type: int (__cdecl*)(_object *)] [+0x150] tp_bases : 0x3af9030 [Type: _object *] [+0x158] tp_mro : 0x3ab3458 [Type: _object *] [+0x160] tp_cache : 0x0 [Type: _object *] [+0x168] tp_subclasses : 0x1 [Type: _object *] [+0x170] tp_weaklist : 0x37ff6e8 [Type: _object *] [+0x178] tp_del : 0x3af9048 [Type: void (__cdecl*)(_object *)] [+0x180] tp_version_tag : 0x0 [Type: unsigned int] gc log: gc: collecting generation 0... gc: objects in each generation: 657 2285 9844 gc: done, 0.0020s elapsed. gc: collecting generation 0... gc: objects in each generation: 594 2861 9843 gc: done, 0.0000s elapsed. gc: collecting generation 0... gc: objects in each generation: 672 3413 9843 gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: done, 48 unreachable, 0 uncollectable, 0.0280s elapsed. gc: collecting generation 0... gc: objects in each generation: 655 3971 9843 gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: done, 40 unreachable, 0 uncollectable, 0.0280s elapsed. gc: collecting generation 1... gc: objects in each generation: 874 4496 9843 gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: done, 64 unreachable, 0 uncollectable, 0.0640s elapsed. gc: collecting generation 0... gc: objects in each generation: 839 0 14971 gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: done, 32 unreachable, 0 uncollectable, 0.0160s elapsed. gc: collecting generation 0... gc: objects in each generation: 824 701 14909 gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: done, 32 unreachable, 0 uncollectable, 0.0180s elapsed. gc: collecting generation 0... gc: objects in each generation: 1371 916 14774 // Thank you in advance // Oleksii From kevin_miller at capgroup.com Tue Jan 24 16:06:42 2017 From: kevin_miller at capgroup.com (Kevin Miller) Date: Tue, 24 Jan 2017 21:06:42 +0000 Subject: [python-win32] Trying to set tab stops in Visio shape In-Reply-To: <03C43DEBC3335C4D9C65B46508B5A58C1EC2358D@SNX1VBMLS001.cguser.capgroup.com> References: <03C43DEBC3335C4D9C65B46508B5A58C1EC2358D@SNX1VBMLS001.cguser.capgroup.com> Message-ID: <03C43DEBC3335C4D9C65B46508B5A58C1EC3268C@SNX1VBMLS001.cguser.capgroup.com> Hi, I figured out how to set the rowtype so that tab stops work. I looked through the PY files for RowType and found RowType and SetRowType. # The method SetRowType is actually a property, but must be used as a method to correctly pass the arguments def SetRowType(self, Section=defaultNamedNotOptArg, Row=defaultNamedNotOptArg, arg2=defaultUnnamedArg): ... The statement that worked: s1.SetRowType(constants.visSectionTab, constants.visRowTab, 151) Kevin Miller -------------- next part -------------- An HTML attachment was scrubbed... URL: