[spambayes-bugs] [ spambayes-Patches-1679796 ] DoBrowse() dialog broken

SourceForge.net noreply at sourceforge.net
Wed Mar 14 09:22:19 CET 2007


Patches item #1679796, was opened at 2007-03-13 14:35
Message generated for change (Comment added) made by igs
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=498105&aid=1679796&group_id=61702

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: Outlook
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Marko von Oppen (igs)
Assigned to: Nobody/Anonymous (nobody)
Summary: DoBrowse() dialog broken

Initial Comment:
On all my test systems (WinXP/WinVistaX64 / OL2007 / Python 2.4.4 / Pythonwin 210) clicking on the 'Browse' buttons in SpamBayes Manager on tab 'Notifications' gave an exception:

TypeError: Argument must be a 88-byte string

I couldn't find out the exact reason of the error because a shortage of documentation. So I wrote a reimplementation using GetOpenFileNameW() instead of GetOpenFileName().

I don't know if the previous code works on older versions of pythonwin32. So I left the old code unchanged and I think that this workaround maybe is the best solution for the problem.

----------------------------------------------------------------------

>Comment By: Marko von Oppen (igs)
Date: 2007-03-14 09:22

Message:
Logged In: YES 
user_id=260951
Originator: YES

No I'm not using any self compiled pywin32 but official binary
distributions of both Python and pywin32.

I can reproduce that on two machines:
1. Vista x64 German
   Python 2.4.4 (binary install from python.org)
   pywin32-2.4-210 binary (downloaded and installed from sf.net)
2. Vmware pc (Host: XP SP2, Guest; XP SP2)
   Python 2.4.4 (binary install from python.org)
   pywin32-2.4-210 binary (downloaded and installed from sf.net)

Here the output from console when running
Outlook2000\dialogs\test_dialogs.py and clicking on the browse buttons:
Traceback (most recent call last):
  File "S:\sbdev\spambayes_clean\Outlook2000\dialogs\dlgcore.py", line
310, in OnCommand
    self.ApplyHandlingOptionValueError(handler.OnCommand, wparam, lparam)
  File "S:\sbdev\spambayes_clean\Outlook2000\dialogs\dlgcore.py", line
262, in ApplyHandlingOptionValueError
    return func(*args)
  File "S:\sbdev\spambayes_clean\Outlook2000\dialogs\opt_processors.py",
line 288, in OnCommand
    self.DoBrowse()
  File "S:\sbdev\spambayes_clean\Outlook2000\dialogs\opt_processors.py",
line 277, in DoBrowse
    retval = win32gui.GetOpenFileName(str(ofn))
TypeError: Argument must be a 88-byte string

I tried to reproduce that under a clean installed Python 2.5 with
pywin32-210 and got another error: When starting test_dialogs.py and
clicking on an arbitrary tab I always get 3 exceptions:

Python WNDPROC handler failed
Traceback (most recent call last):
  File "S:\sbdev\spambayes_clean\Outlook2000\dialogs\dlgcore.py", line
288, in OnNotify
    hwndFrom, idFrom, code = struct.unpack(format, buf)
  File "C:\Python25\lib\struct.py", line 87, in unpack
    return o.unpack(s)
struct.error: unpack requires a string argument of length 12
Python WNDPROC handler failed
Traceback (most recent call last):
  File "S:\sbdev\spambayes_clean\Outlook2000\dialogs\dlgcore.py", line
288, in OnNotify
    hwndFrom, idFrom, code = struct.unpack(format, buf)
  File "C:\Python25\lib\struct.py", line 87, in unpack
    return o.unpack(s)
struct.error: unpack requires a string argument of length 12
Python WNDPROC handler failed
Traceback (most recent call last):
  File "S:\sbdev\spambayes_clean\Outlook2000\dialogs\dlgcore.py", line
288, in OnNotify
    hwndFrom, idFrom, code = struct.unpack(format, buf)
  File "C:\Python25\lib\struct.py", line 87, in unpack
    return o.unpack(s)
struct.error: unpack requires a string argument of length 12

Looking a little bit like coming from the same corner...

Because I think it won't be so easy to debug the C code in the binary
release I will have a look at the Python part.

Marko


----------------------------------------------------------------------

Comment By: Mark Hammond (mhammond)
Date: 2007-03-14 01:45

Message:
Logged In: YES 
user_id=14198
Originator: NO

It still works fine for me with the current CVS of pywin32.  The code in
question references 'sizeof(OPENFILENAME)' - is it possible you are
building your own pywin32, and the windows headers you use have a different
definition of OPENFILENAME?

Looking at CommDlg.h, I see there are various different OPENFILENAME
structures (eg, LPOPENFILENAME_NT4) - that is probably the root cause of
the problem.  I'm reluctant to apply this patch without better
understanding the problem you are seeing.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=498105&aid=1679796&group_id=61702


More information about the Spambayes-bugs mailing list