import ctypes mylib = ctypes.CDLL('./library_bridge.so') mylib.print_text("/dev/usb/lp0".encode('utf-8'), "test\n".encode('utf-8')) mylib.print_text("/dev/usb/lp0".encode('utf-8'), "test\n".encode('utf-8')) mylib.print_text("/dev/usb/lp0".encode('utf-8'), "test\n".encode('utf-8')) mylib.cut("/dev/usb/lp0".encode('utf-8'))