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

Glenn Linderman v+python at g.nevcal.com
Tue Nov 20 00:52:23 EST 2018


On 11/19/2018 11:52 AM, Tim Roberts wrote:
> Glenn Linderman wrote:
>>
>> I've not coded up the equivalent C program, as I don't have a C 
>> compiler installed here, and haven't done any C coding for 8 or 10 
>> years.
>>
>> Were you able to reproduce the problem, or is your error analysis 
>> based on code reading?
>
> I looked at the code.  Plus, I recognized that 1804 is a Windows 
> errors code, not a Python error.  Let me see if I can write up a C++ 
> test that would be useful for you.

I looked at the win32print.cpp file. There were lots of Python-internals 
stuff there that I don't really follow well. I didn't see anything 
obviously wrong, but I got to wondering about the code that builds the 
structure... it puts in UTF-8 text strings (which would be same as ASCII 
in the cases I'm considering, but what if someone has a non-ASCII 
printer name, or document file name, or ???). And I'm sure the A version 
of the Windows API probably is happy with ASCII, but does the 64-bit 
compilation call the A version of the Windows API or the W version?  And 
would the W version be happy with ASCII? Or would that produce an 1804 
error?

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.

And then of course, I've no idea what compilation parameters were used, 
either for your program (which works), or for win32print.cpp (which 
maybe doesn't).

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


More information about the python-win32 mailing list