Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes and updates #78

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Conversation

CristiFati
Copy link

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant