Bugs item #1295741, was opened at 2005-09-20 05:45
Message generated for change (Comment added) made by mhammond
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=551954&aid=1295741&group_id=78018
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: com
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Philip Reed (philipreed)
Assigned to: Nobody/Anonymous (nobody)
Summary: win32com: Lotus Notes IDocument.Authors crashes python
Initial Comment:
Sorry in advance for a Notes-specific question, but I'm
guessing Notes is just the stimulus that's provoking
some kind of issue in win32com and python. I'm
having trouble using win32com to access Lotus Notes
email. Specifically, an attempt to get the Authors
attribute of an IDocument crashes Python.
In essence I'm attempting to port the VB example code
from http://www.tek-tips.com/viewthread.cfm?qid=67791
to Python. Running the code sample below crashes
with standard Windows error messages (The instruction
at [memaddress] referenced memory at "0x00000005".
The memory could not be "read") in three different
environments:
- From a Windows 2000 console interface. Dialog title
is "python.exe - Application Error"
- From IDLE. Dialog title is "pythonw.exe - Application
Error"
- From PythonWin. Title is "PythonWin:
PythonWin.exe - Application Error". This is particularly
egregious since it cascades into an MFC error that
crashes the PythonWin editor!
** DEMO CODE **
import win32com.client
sess = win32com.client.Dispatch
("Lotus.NotesSession") #instance of ISession
sess.Initialize() #Will prompt for password first time
through
mailDb = sess.GetDatabase("", sess.UserName)
mailDoc = mailDb.CreateDocument()
b= mailDoc.IsValid #This works
print "MailDoc.IsValid: ", b
url = mailDoc.HttpURL #This works
print "mailDoc.HttpURL ", url
input = raw_input("Are you sure you want to crash
PythonWin?")
if input == "yes":
print "Prepare for crash..."
auths = mailDoc.Authors
print "mailDoc.Authors", auths
else:
print "Chicken! Enjoy the safe landing"
** OUTPUT **
(Note: I made some minor hacks to
win32com\client\__init__.py in _ApplyTypes_() and
__getattr__() to enhance output.)
(Also: Notes prompts for the password in a console,
which shows up separately in Idle.)
Class ID: {29131578-2EED-1069-BF5D-00DD011186B7}
Class ID: {29131567-2EED-1069-BF5D-00DD011186B7}
MailDoc.IsValid: True
Class ID: {29131567-2EED-1069-BF5D-00DD011186B7}
mailDoc.HttpURL:
Are you sure you want to crash PythonWin?yes
Prepare for crash...
Class ID: {29131567-2EED-1069-BF5D-00DD011186B7}
about to fail!
wFlags: 2
*************
I also tried loading Python with -vd flags, which produces
extra output I'll attach in a file.
Any suggestions? Any way to further troubleshoot w/o
hacking around in Python C++ source (e.g., turning on
better debugging)?
TIA,
Philip
----------------------------------------------------------------------
>Comment By: Mark Hammond (mhammond)
Date: 2005-09-23 08:51
Message:
Logged In: YES
user_id=14198
This appears to be an access violation inside MFC itself.
Without a debugger it will be very hard to track down. It
may not crash in Python 2.3 as that uses a different MFC
version. It should also not fail when using python.exe, as
MFC is out of the picture.
----------------------------------------------------------------------
Comment By: Philip Reed (philipreed)
Date: 2005-09-20 05:48
Message:
Logged In: YES
user_id=392466
I forgot to note, this is Python 2.4 pywin32 extensions (build
204) - Philip
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=551954&aid=1295741&group_id=78018
|