Error while uploading files to GPy



  • While I'm trying to upload files to GPy, I find the following error

      File "main.py", line 6, in <module>
      File "sensors.py", line 1
    SyntaxError: invalid syntax
    MicroPython v1.8.6-849-83e2f7f on 2018-03-19; GPy with ESP32
    Type "help()" for more information.
    

    Here is the first line of sensors.py file
    from machine import Pin, I2C, Timer, UART, ADC
    It was working all fine till yesterday and today I implemented a new function and facing this issue. Also, on running sensors.py separately using console, it isn't showing any syntax errors and running fine.
    What could have gone wrong here?



  • @jmarcelino @robert-hh Thank you for the inputs guys!
    This is what solved the issue for me,
    I thoroughly debugged the functions written in sensors.py file. There were some errors in the newly implemented functions which I corrected and then things started working fine!



  • Hi @sprasad

    How are you uploading the files to the GPy, using Pymakr plugin for Atom/VS Code?

    There was a bug in Pymakr causing corruption the first byte of the file in some specific cases (number of characters on the file - if your code has between 6912 and 7167 characters you’d have tripped on this problem)

    This should have been fixed in the latest release. If you're using Pymakr please update it.



  • @sprasad Micropython is sometimes 1 of in line number errors. So the actual error could be in line 2. When you say "run from console", do the start that bye:
    import sensors
    of by pasting the content? The latter case could hide a tab/space mix in the file.


 

Pycom on Twitter