[python-win32] why do I get error 1804 from win32print.SetJob?

Glenn Linderman v+python at g.nevcal.com
Tue Nov 20 14:24:33 EST 2018


On 11/20/2018 10:49 AM, Tim Roberts wrote:
> Glenn Linderman wrote:
>> Of course, the GetJob is decoding the structure properly... but its 
>> PyBuildValue parameter strings are much more complex than the 
>> PyArg_ParseTupleAndKewyords parameter strings, and there is mention 
>> of TCHAR in the JobToPy, but not in the PyToJob, so that makes it 
>> further seem like my speculations above might have some chance of 
>> being the problem.
>
> I should not have scoffed at your speculation, because your analysis 
> was correct.  The win32print code is calling SetJobW, which expects 
> Unicode, but the JOB_INFO_1 structure is filled with ANSI strings.  
> That's a very nasty bug.  I'll file a bug report.
>
> In the meantime, I'll fix up my little C++ example to do the job for you.

Hi Tim,

I understand that it is easy to look at code and think you know what it 
is doing, until the debugger proves otherwise. I've been there plenty of 
times. Fortunately in this case, my speculations were based on _not_ 
thinking I knew what the code was doing, and _not_ having a clue how 
most of the called routines worked, so my mind was freed from such 
restrictions, and I could make a lucky guess!

I appreciate your taking time to follow through.

BTW, Google's email spam filter that hates .zip files can easily be 
circumvented, by adding another extension to the file... as in 
file.zip.removeme

Glenn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20181120/b923f647/attachment.html>


More information about the python-win32 mailing list