Pybytes stale file data



  • This problem seems to keep popping up.
    I have my devices loaded with the current firmware. 1.20.2.r0

    I've been provisioning new devices using Pybytes.
    First, I load a file to main.py that creates all of the library files by writing to /flash/lib/

    files=['bme680.py','constants.py','lorakeys.py','nets.py','si11xx.py','i2c.py']
    for c in files:
      fn='/flash/lib/' + c
      f=open(fn,'w')
      f.write('#hello')
      f.close()
    

    After that, I overwrite main.py with my actual normal main.py
    After I upload all of the correct files to the ones created in /flash/lib/ everything seems to be working. It's publishing data to the pybytes signals and sending data over LoRa.
    But if I close/reopen the browser and go look at pybytes again, all of those files are showing stale (#Hello) yet the correct library files have to be in there, since the device is running and utilizing all of these libraries.
    I've tried using the "Refresh Hierarchy" button and that doesn't seem to change anything.
    I've also tried re-writing all of these files a second time, and that does seem to 'fix it' But it would be nice if this would actually get fixed, so I don't have to waste dozens of minutes per device..



  • The feature is indeed relatively new, which might explain the bug you found, I will put that forward.



  • @Gijs I didn't know about the 'add file' option.. I don't remember seeing it there previously.

    I tried deleting a file that way then re-creating it... When recreated, pybytes seems to restore it from the garbage bin with the same stale data.

    I also did some testing using FTP to upload to my LoPy4's. I started out with a fresh unit I just purchased, flashed it to the latest firmware 1.20.2.r1 and FTP'ed all the files over. Pybytes still doesn't seem to accurately reflect what's stored in flash.



  • @dnear1 said in Pybytes stale file data:

    files=['bme680.py','constants.py','lorakeys.py','nets.py','si11xx.py','i2c.py']
    for c in files:
    fn='/flash/lib/' + c
    f=open(fn,'w')
    f.write('#hello')
    f.close()

    What you could do instead of this, is rightclick on a folder in Pymakr Online or on the device name, and click 'add folder' or 'add file' to add the files you need. I do think your solution is quite creative!

    After I upload the file-creating main.py, It will automatically reset and refresh the hierarchy when it comes back online.

    Edit: the Pymakr online does not work after calling os.fsformat("/flash"), ill add that to the buglist :)



  • That indeed sounds like a bug to me. As Pymakr online is still quite new, we are still working on adding new features and fixes. I will take a more in-depth look at this tomorrow!
    Gijs


Log in to reply
 

Pycom on Twitter