[python-win32] Re: Strange printing with Pythonwin

Roger Upole rwupole at msn.com
Sat Dec 16 12:55:43 CET 2006


Jesus Aguillon wrote:
> Hello all,
> I am experiencing a problem when I try to print a script from within
> PythonWin.  I will occasionally only get  blank pages printed.  When I try
> to preview the print it will also show blank pages.  It seems that this is
> an intermittent problem since at times it will print correctly.  Has anyone
> experienced a similar issue?
> 
> I am running on Windows XP SP2 and the following is displayed when I bring
> up PythonWin.
> 
> PythonWin 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)]
> on win32.
> Portions Copyright 1994-2006 Mark Hammond - see 'Help/About PythonWin' for
> further copyright information.
>>>> C:\Python25\Lib\site-packages\pythonwin\pywin\scintilla\view.py:641:
> DeprecationWarning: 'L' format requires 0 <= number <= 4294967295
>  fr = struct.pack('LLIIIIIIIIll', hdcRender, hdcFormat, rc[0], rc[1],
> rc[2], rc[3], rc[0], rc[1], rc[2], rc[3], pageStart, lengthDoc)
> 
> Thank you,
> -- 
> jesusATaguillonDOTcom

>From looking at the struct.pack format, I think you're running into DC handles
with negative values.  Pywin32 treats handles as signed longs.
There appears to be a difference in how 2.4 and 2.5 handle them:

2.4:
>>> struct.pack('l',-4100000)
'`p\xc1\xff'
>>> struct.pack('L',-4100000)
'`p\xc1\xff'


2.5:
>>> struct.pack('l',-4100000)
'`p\xc1\xff'
>>> struct.pack('L',-4100000)
__main__:1: DeprecationWarning: 'L' format requires 0 <= number <= 4294967295
'\x00\x00\x00\x00'

Try changing the sruct.pack format to lower case l's, and if that solves your problem
I'll change it in CVS.

      Roger








More information about the Python-win32 mailing list