Skip to content

Pycups pip installation error  #61

Description

@Roboflex30

Hi, I am trying to print a file in one of my 3 printers( I want the printers to be selected dynamically i.e. as per my use). But I am getting an error. The error goes as follows
**Collecting pycups
Using cached pycups-2.0.4.tar.gz (65 kB)
Preparing metadata (setup.py) ... done
Building wheels for collected packages: pycups
Building wheel for pycups (setup.py) ... error
error: subprocess-exited-with-error

× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [1 lines of output]
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pycups
Running setup.py clean for pycups
Failed to build pycups
ERROR: Could not build wheels for pycups, which is required to install pyproject.toml-based projects**

Can someone help me with this? I am using below code for my use case
import cups

def print_file(file_path, printer_name):

conn = cups. Connection()

printers = conn.getPrinters()

if printer_name in printers:
    try:
        conn.printFile(printer_name, file_path, "Print Job", {})
        print("File sent to printer successfully.")
    except cups.IPPError as e:
        print(f"Error printing file: {e}")
else:
    print(f"Printer '{printer_name}' not found.")

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions