# -*- coding: utf-8 -*-# LibreOffice 用マクロimport unodef CardRead(*args):import nfcfrom nfc.clf import RemoteTargetdef on_connect(tag):doc = XSCRIPTCONTEXT.getDocument()sheet = doc.getSheets().getByName('CardMst')cell = sheet.getCellByPosition(1,1)cell.String = str(tag)def main():while True:with nfc.ContactlessFrontend('usb') as clf:clf.connect(rdwr={'on-connect': on_connect})main()
com.sun.star.uno.RuntimeException: Error during invoking function CardRead in module file:///C:/Program%20Files/LibreOffice/share/Scripts/python/nfc_get_card_info.py (<class 'usb1.USBErrorAccess'>: LIBUSB_ERROR_ACCESS [-3]File "C:\Program Files\LibreOffice\program\pythonscript.py", line 907, in invokeret = self.func( *args )<略>File "C:\Users\hoge\AppData\Roaming\Python\Python35\site-packages\usb1\__init__.py", line 125, in raiseUSBErrorraise __STATUS_TO_EXCEPTION_DICT.get(value, __USBError)(value))