Skip to content

Fixes and updates - #78

Open
CristiFati wants to merge 7 commits into
ActiveState:masterfrom
CristiFati:cfati_dev00
Open

CristiFati wants to merge 7 commits into
ActiveState:masterfrom
CristiFati:cfati_dev00

Conversation

@CristiFati

Copy link
Copy Markdown

The main one is setting functions argtypes and restype. Modern Python versions raise an exception:

Traceback (most recent call last):
  File "..\..\GitHub\CristiFati\code\recipes\Python\305690_Enumerate_printer_job\recipe-305690.py", line 194, in <module>
    prt.EnumJobs(pJob, prt.pcbNeeded)
  File "..\..\GitHub\CristiFati\code\recipes\Python\305690_Enumerate_printer_job\recipe-305690.py", line 164, in EnumJobs
    ret = ws.EnumJobsA(self.OpenPrinter(),
ctypes.ArgumentError: argument 5: <class 'OverflowError'>: int too long to convert

preventing funky Undefined Behaviors: [SO]: C function called from Python via ctypes returns incorrect value (@CristiFati's answer).

I'm not sure how some of the code worked (if it did). Still uncertain about ReadPrinter part.

There are other problems to be addressed:

  • Some harcodings (int values)
  • Error checking (via GetLastError)
  • Some structures are out of date
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant