• How can I track my error on onewire library

    LoPy onewire lopy4 nameerror ds18b20
    5
    0 Votes
    5 Posts
    928 Views
    pierrot10P
    @robert-hh Hello. Thnak for your reply. Apparently, after the transfer, a H (or a I, etc) is added as the first caracter, as the following: H#!/usr/bin/env python3 """ OneWire library for MicroPython """ It the reason why I got that error. The problem, I can not correct it directely because after saving it, the file become newer than the source and it will be overwritten at the next sync. Then I look at the other lib file and I observed than none of them has that line. I remove and it work until I got a message stating, it can not imported DS18X20. I first open my file with textwrangler, then I open it with Atom and I observed, the text was terribly formated (A lot on the same line). I reformat it and it's works but not always.. Now the problem it state a Traceback (most recent call last): File "main.py", line 9, in <module> File "/flash/lib/onewire.py", line 2 SyntaxError: invalid syntax here is line two: #!/usr/bin/env python3 """ OneWire library for MicroPythonß """ import time import machine class OneWire: What is wrong? Then I gave a spave (return key) before the """ and I got the same error message Traceback (most recent call last): File "main.py", line 9, in <module> File "/flash/lib/onewire.py", line 1, in <module> NameError: name 'A' is not defined Then how can sync my onewire file without a formatting issue and with a unwish caracter before the first line? Does I need to check something on Atom? Thabk for your help EDIT: OK. Problem seems to be solved. I copy again the content of onewire.py to /Flash/lib/onwire.py and on Atom, at the bottom right, I changed LF to CRLF. The problem does not appear any more. That funny because my main.py has LF (and not CRLF) and I do not have this problem with main.py
  • LoPy doesn't run applications which ran before

    LoPy lopy problem nameerror
    2
    0 Votes
    2 Posts
    885 Views
    B
    Hi @cylex can you please share your code so we can help you? Thanks, Alex