Note that there are some explanatory texts on larger screens.

plurals
  1. PORunning python scripts on android
    primarykey
    data
    text
    <p>I'am struggling running a python script which should allow me to write a text to a tag by using the nfcpy.The code is downloaded from <a href="https://code.launchpad.net/nfcpy" rel="nofollow">https://code.launchpad.net/nfcpy</a></p> <p>I have installed LS4A on my android device, but when I try to run the program the shell tells me that I miss the <code>import nfc</code> package. I tried google, but to no help. So can anybody tell me how I should solve this problem? </p> <pre><code>#!/usr/bin/python # -*- coding: latin-1 -*- # ----------------------------------------------------------------------------- # Copyright 2011 Stephen Tiedemann &lt;stephen.tiedemann@googlemail.com&gt; # # Licensed under the EUPL, Version 1.1 or - as soon they # will be approved by the European Commission - subsequent # versions of the EUPL (the "Licence"); # You may not use this work except in compliance with the # Licence. # You may obtain a copy of the Licence at: # # http://www.osor.eu/eupl # # Unless required by applicable law or agreed to in # writing, software distributed under the Licence is # distributed on an "AS IS" basis, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either # express or implied. # See the Licence for the specific language governing # permissions and limitations under the Licence. # ----------------------------------------------------------------------------- import os import sys import time sys.path.insert(1, os.path.split(sys.path[0])[0]) import nfc import nfc.ndef import nfc.ndef.Text 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.Text.TextRecord( ("en", "Hello World") ) text_de = nfc.ndef.Text.TextRecord( ("de", "Hallo Welt") ) text_fr = nfc.ndef.Text.TextRecord( ("fr", "Bonjour tout le monde") ) message = nfc.ndef.Message( [text_en, text_de, text_fr] ) tag.ndef.message = message.tostring() 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.Text.TextRecord( record ) print text.language + ": " + text.text if __name__ == '__main__': main() </code></pre> <p>Thanks in advance!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload