1

私は初心者です。libUSB、Python、および PyUSB パッケージをインストールした後、私の ACR122U はコンピューターに接続されています。次に、次のようなコードを実現したいと考えています。

import os
import sys
import time

sys.path.insert(1, os.path.split(sys.path[0])[0])

import nfc
import nfc.ndef

def main():
    clf = nfc.ContactlessFrontend()

    print "Please touch a tag to send a hello to the world"
    while True:
        tag = clf.poll()
        if tag and tag.ndef:
            break

    text_en = nfc.ndef.TextRecord(language="en", text="Hello World")
    text_de = nfc.ndef.TextRecord(language="de", text="Hallo Welt")
    text_fr = nfc.ndef.TextRecord(language="fr", text="Bonjour tout le monde")
    message = nfc.ndef.Message( [text_en, text_de, text_fr] )

    tag.ndef.message = str(message)

    print "Remove this tag"
    while tag.is_present:
        time.sleep(1)

    print "Now touch it again to receive a hello from the world"
    while True:
        tag = clf.poll()
        if tag and tag.ndef:
            break

    message = nfc.ndef.Message( tag.ndef.message )
    for record in message:
        if record.type == "urn:nfc:wkt:T":
            text = nfc.ndef.TextRecord( record )
            print text.language + ": " + text.text

if __name__ == '__main__':
    main()

ラインに着いたら

clf= nfc.ContactlessFrontend()"

それから質問が来ました:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "D:\tools\python\nfc\clf.py", line 58, in __init__
raise LookupError("couldn't find any usable nfc reader")
LookupError: couldn't find any usable nfc reader

解決方法がわかりません。誰か助けてくれませんか?

4

1 に答える 1