Search code examples
pythonxbeemicropython

Xbee Micropython EEXIST error when call file open() function


I'm using Xbee3 and I want to append data to file.

I try this script for test but I received EEXIST error if TEST.txt file exists. If this file doesn't exist the file is created for the first run but I get same error when I run this script again.

f = open("TEST.txt", 'a')
for a in range(3):
    f.write("#EMPTY LINE#\n")
f.close()

Traceback (most recent call last): File "main", line 1, in OSError: [Errno 7017] EEXIST

I formatted xbee by the way.


Solution

  • It's sounds like you're using an 802.15.4, DigiMesh or Zigbee module. The file system in those modules is extremely limited, and doesn't allow for modifying existing files. There should be documentation on the product that lists those limitations (no rename, no modify/append, only one open file at a time, etc.)

    XBee/XBee3 Cellular modules have a fuller file system implementation that allows for renaming files and modifying file contents.