Re: [python-win32] Pythoncom error
On 3/15/06, Mark Hammond <[EMAIL PROTECTED]> wrote: > > Hello, > > I'm stress testing an application I have written using the Python Asp > > bindings, on occasions I get an ASP 0147 error (Internal Server > > Error), In the IIS logs it manifests itself as a c005 trapable > > error. > > That sounds like an Access Violation is happening - which probably is *not* > directly related to the error below: > > > File "C:\Python24\Lib\site-packages\win32comext\axdebug\adb.py", > > line 262, in CloseApp > > self.appEventConnection.Disconnect() > > File "C:\Python24\Lib\site-packages\win32com\client\connect.py", > > line 41, in Disconnect > > self.cp.Unadvise(self.cookie) > > This error is specific to the debugger support. It would be safe to change > line 262 of abd.py from: > > self.cp.Unadvise(self.cookie) > to: > try: > self.cp.Unadvise(self.cookie) > except pythoncom.com_error: > pass > > That *should* get you into the debugger OK - but it probably does not get > you much closer to the original error. > > Another thing to try: > * Change to win32comext\axscript\client > * execute "pyscript.py --debug" > * Start Pythonwin, and open the Tools -> Remote Collector Debugging Tool > * Restart your app. > > You should see *lots* of stuff being spewed to Pythonwin as your app runs. > When you app finally dies, the tail of this log might be interesting - eg, > any tracebacks being displayed, or any evidence of death *inside* Python > etc. > > Mark > Hi Mark, thanks for the reply. Here's the thing; I took your advice and kept an eye out for errors related to the debugger support and fixed them when I found them (often with a just quick try except clause as you suggested, I'll revisit them when I get time), there where three locations where the debugger code raised exceptions. After making those changes my application has become significantly more stable. Is it possible that the debugger support code is running all the time, even when a debugger is not attached? (Or that I am missing something and "accidently" running a debugger, IIS is still a bit of a mystery to me). How can I be 100% sure that the debug stuff is disabled? As an example, One thing I have noticed is that I now get "WARNING:Ignoring Keyboard Interrupt from scripting engine" and everything continues as normal, I'm think that producing that warning used to cause a raised exception and kill my app. Does any of this sound feasible? I'm still getting the original access violation (but I am seeing proper debugger output) so there is an issue in my C extension code but the difference in stability is siginificant. Cheers, Emlyn. ___ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
Re: [python-win32] Pythoncom error
> Here's the thing; I took your advice and kept an eye out for errors > related to the debugger support and fixed them when I found them > (often with a just quick try except clause as you suggested, I'll > revisit them when I get time), Please do, and feed the changes you made back to me (even if I change them before adopting them) > there where three locations where the > debugger code raised exceptions. After making those changes my > application has become significantly more stable. Is it possible that > the debugger support code is running all the time, even when a > debugger is not attached? Yes, that is correct. See SetScriptSite in win32comext\axscript\client\framework.py - this code enables debugging support quite early on, and before it is actually requested. This could almost certainly be optimized (although the overhead of that, assuming it works correctly, should be low.) As you should see from that code, allowing self.debugManager to remain None should gracefully work without debugging support. Renaming the win32comext\axdebug directory away should cause that :) > "WARNING:Ignoring Keyboard Interrupt from scripting engine" and > everything continues as normal, I'm think that producing that warning > used to cause a raised exception and kill my app. Does any of this > sound feasible? Sure does! Sadly that "Ignoring..." message is worming around a very old problem I have with IIS and the "random" triggering of Ctrl+C signals that so far remains unexpained :( On the positive side, since adding that work-around (a number of years ago now), people have reported their problems caused by the lack of the work around vanished (ie, that message should be benign) Cheers, Mark ___ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
[python-win32] problem w/ outlook scripting
I have the below script to play around with contact lists in outlook. When it runs, I get a popup in outlook asking me if i want to gve the script access, I say yes, it seesm to run okay, but no new distribution list in my contact folder is created. I have very similar VBA code which runs just fine as a macro and creates the list, any ideas? Thanks! -Michael import win32com.clientimport sys, osmyOlApp = win32com.client.Dispatch("Outlook.Application")myNameSpace = myOlApp.GetNamespace("MAPI")myDistList = myOlApp.CreateItem(win32com.client.constants.olDistributionListItem )myTempItem = myOlApp.CreateItem(win32com.client.constants.olMailItem)myRecipients = myTempItem.RecipientsmyDistList.DLName = "Test"myRecipients.Add("(Test Name) [EMAIL PROTECTED]")myRecipients.ResolveAllmyDistList.AddMembers(myRecipients) myTempItem2 = myOlApp.CreateItem(win32com.client.constants.olMailItem)myRecipients2 = myTempItem2.RecipientsmyRecipients2.Add ("(Mr. Vlarg) [EMAIL PROTECTED]")myRecipients2.ResolveAllmyDistList.AddMembers(myRecipients2) myTempItem3 = myOlApp.CreateItem(win32com.client.constants.olMailItem )myRecipients3 = myTempItem3.RecipientsmyRecipients3.Add("[EMAIL PROTECTED]")myRecipients3.ResolveAll myDistList.RemoveMembers(myRecipients3) myDistList.Save myDistList.Display ___ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
[python-win32] NT Service not re-startable after reboot
I have a Python service (vmpro_pager.py) which worked fine when I wrote it a month ago. You can see the complete source code here: http://projects.amor.org/misc/browser/vmpro_pager.py It runs an SMTP proxy to clean up SMTP messages from a sender which is not compliant with the SMTP spec. Today, we found out that the service was not running, and had not been running for some time; my best guess is since the first reboot after the service was installed. Attempts to remove the service via "vmpro_pager.py remove" failed, complaining that no such service was installed. After manually deleting the appropriate registry keys, I am able to run "vmpro_pager.py install" with no problems. However, starting the service from Windows Service Manager fails with the message, "Windows could not start the Voicemail Pro Email Fixup service on Local Computer. For more information, review the System Event Log. If this is a non-Microsoft service, contact the service vendor, and refer to service-specific error code 1." The Event Log contains a single Error event with the Description: "The Voicemail Pro Email Fixup service terminated with service-specific error 1." The PYS_SERVICE_STARTED message from SvcDoRun is *not* in the Event Log. Running the service via "vmpro_pager.py debug", however, works perfectly. Although I'm certainly open to answers of the type, "here's your problem..." ;) I'd like to also where I can insert hooks to return an error code more-meaningful than "1" in the future. Robert Brewer System Architect Amor Ministries [EMAIL PROTECTED] ___ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
Re: [python-win32] problem w/ outlook scripting
Try ensuring all methods have parens - eg: > myDistList.Save > myDistList.Display May not have any effect without the trailing () to indicate a method call. Mark ___ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
Re: [python-win32] NT Service not re-startable after reboot
I'm afraid I've no idea. The first thing to check is that username configured to use the service, and check that the service does not rely on any network shares or similar. Most service problems relate to this (eg, trying to run a service from a mapped drive as the LocalSystem account doomed to failure. After that, I'd suggest importing win32traceutil early in your program and trying to determine if you module is being entered at all. However, that seems unlikely - once the service framework gets to the point it tries to import your module, it should also be at the point where it can correctly log any Python errors caused by the import and write them to the event log. Good luck! Mark > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Behalf Of Robert Brewer > Sent: Friday, 17 March 2006 7:26 AM > To: python-win32@python.org > Subject: [python-win32] NT Service not re-startable after reboot > > > I have a Python service (vmpro_pager.py) which worked fine when I wrote > it a month ago. You can see the complete source code here: > http://projects.amor.org/misc/browser/vmpro_pager.py It runs an SMTP > proxy to clean up SMTP messages from a sender which is not compliant > with the SMTP spec. Today, we found out that the service was not > running, and had not been running for some time; my best guess is since > the first reboot after the service was installed. > > Attempts to remove the service via "vmpro_pager.py remove" failed, > complaining that no such service was installed. After manually deleting > the appropriate registry keys, I am able to run "vmpro_pager.py install" > with no problems. However, starting the service from Windows Service > Manager fails with the message, "Windows could not start the Voicemail > Pro Email Fixup service on Local Computer. For more information, review > the System Event Log. If this is a non-Microsoft service, contact the > service vendor, and refer to service-specific error code 1." The Event > Log contains a single Error event with the Description: "The Voicemail > Pro Email Fixup service terminated with service-specific error 1." The > PYS_SERVICE_STARTED message from SvcDoRun is *not* in the Event Log. > > Running the service via "vmpro_pager.py debug", however, works > perfectly. > > Although I'm certainly open to answers of the type, "here's your > problem..." ;) I'd like to also where I can insert hooks to return an > error code more-meaningful than "1" in the future. > > > Robert Brewer > System Architect > Amor Ministries > [EMAIL PROTECTED] > > ___ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 > ___ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
Re: [python-win32] NT Service not re-startable after reboot
FWIW, here's the output from win32\test\testall.py (I don't know if I should assume that all should pass or not). This is on a Win2k Server with Python 2.4.2 and pywin32 build 207: C:\Python24\Lib\site-packages\win32\test>python testall.py E.EExcep tion in thread Thread-3: Traceback (most recent call last): File "C:\Python24\lib\threading.py", line 442, in __bootstrap self.run() File "C:\Python24\lib\threading.py", line 422, in run self.__target(*self.__args, **self.__kwargs) File "C:\Python24\Lib\site-packages\win32\test\test_win32pipe.py", line 13, in _workerThread data = win32pipe.CallNamedPipe(self.pipename,"foo\0bar", 1024, win32pipe.NMPWAIT_WAIT_FOREVER) error: (231, 'CallNamedPipe', 'All pipe instances are busy.') ...Trying: import win32timezone, datetime Expecting nothing ok Trying: assert 'Mountain Standard Time' in win32timezone.GetTimeZoneNames() Expecting nothing ok Trying: tzi = TimeZoneInfo( 'Mountain Standard Time' ) Expecting nothing ok Trying: now = datetime.datetime.now( tzi ) Expecting nothing ok Trying: now.utcoffset() in ( datetime.timedelta(-1, 61200), datetime.timedelta(-1, 64800) ) Expecting: True ok Trying: now = datetime.datetime.now( TimeZoneInfo( 'Mountain Standard Time', True ) ) Expecting nothing ok Trying: now.utcoffset() Expecting: datetime.timedelta(-1, 61200) ok Trying: aug2 = datetime.datetime( 2003, 8, 2, tzinfo = tzi ) Expecting nothing ok Trying: aug2.utctimetuple() Expecting: (2003, 8, 2, 6, 0, 0, 5, 214, 0) ok Trying: nov2 = datetime.datetime( 2003, 11, 2, tzinfo = tzi ) Expecting nothing ok Trying: nov2.utctimetuple() Expecting: (2003, 11, 2, 7, 0, 0, 6, 306, 0) ok Trying: aug2.isoformat() Expecting: '2003-08-02T00:00:00-06:00' ok Trying: aug2est = aug2.astimezone( win32timezone.TimeZoneInfo( 'Eastern Standard Time' ) ) Expecting nothing ok Trying: aug2est.isoformat() Expecting: '2003-08-02T02:00:00-04:00' ok Trying: est = win32timezone.TimeZoneInfo( 'Eastern Standard Time' ) Expecting nothing ok Trying: est.displayName Expecting: u'(GMT-05:00) Eastern Time (US & Canada)' ok Trying: gmt = win32timezone.TimeZoneInfo( 'GMT Standard Time', True ) Expecting nothing ok Trying: gmt.displayName Expecting: u'(GMT) Greenwich Mean Time : Dublin, Edinburgh, Lisbon, London' ok Trying: import pickle Expecting nothing ok Trying: tz = win32timezone.TimeZoneInfo( 'China Standard Time' ) Expecting nothing ok Trying: tz == pickle.loads( pickle.dumps( tz ) ) Expecting: True ok Trying: localTZ = GetLocalTimeZone() Expecting nothing ok Trying: nowLoc = datetime.datetime.now( localTZ ) Expecting nothing ok Trying: nowUTC = datetime.datetime.utcnow( ) Expecting nothing ok Trying: ( nowUTC - nowLoc ) < datetime.timedelta( seconds = 5 ) Expecting: Traceback (most recent call last): ... TypeError: can't subtract offset-naive and offset-aware datetimes ok Trying: nowUTC = nowUTC.replace( tzinfo = TimeZoneInfo( 'GMT Standard Time', True ) ) Expecting nothing ok Trying: ( nowUTC - nowLoc ) < datetime.timedelta( seconds = 5 ) Expecting: True ok 25 items had no tests: win32timezone.GetIndexedTimeZoneNames win32timezone.GetSortedTimeZoneNames win32timezone.GetTimeZoneNames win32timezone.TimeZoneInfo win32timezone.TimeZoneInfo.GetDSTEndTime win32timezone.TimeZoneInfo.GetDSTStartTime win32timezone.TimeZoneInfo._FindTimeZoneKey win32timezone.TimeZoneInfo._LoadInfoFromKey win32timezone.TimeZoneInfo._LocateDay win32timezone.TimeZoneInfo.__cmp__ win32timezone.TimeZoneInfo.__getinitargs__ win32timezone.TimeZoneInfo.__init__ win32timezone.TimeZoneInfo.__repr__ win32timezone.TimeZoneInfo.__str__ win32timezone.TimeZoneInfo._getDaylightBias win32timezone.TimeZoneInfo._getStandardBias win32timezone.TimeZoneInfo.daylightBias win32timezone.TimeZoneInfo.dst win32timezone.TimeZoneInfo.standardBias win32timezone.TimeZoneInfo.tzname win32timezone.TimeZoneInfo.utcoffset win32timezone._RegEnumerator win32timezone._RegKeyDict win32timezone._RegKeyEnumerator win32timezone._RegValueEnumerator 2 items passed all tests: 21 tests in win32timezone 6 tests in win32timezone.GetLocalTimeZone 27 tests in 27 items. 27 passed and 0 failed. Test passed. ... == ERROR: testFtpCommand (test_win32inet.TestNetwork) -- Traceback (most recent call last): File "C:\Python24\Lib\site-packages\win32\test\test_win32inet.py", line 44, in testFtpCommand INTERNET_SERVICE_FTP, 0, 0) error: (12029, 'InternetConnect', 'A connection with the server could not be established') == ERROR: t