No such device found


I am trying to write to a file using python. Its a simple program,

import sys
logfile = open(“/”, ‘w’)
logfile.write(‘test succeeded’)
print file(‘test.log’).read()

logfile = open(‘test.log’, ‘a’)
logfile.write(‘line 2’)
print file(‘test.log’).read()

After running the code, I am getting the error,

IOError: [Errno 19] No such device: ‘/’

Please help me with this code…


The filesystem in these devices is limited, so understanding what operation you are intending will help determine whether what you are trying is feasible.

Are you hoping to have a directory per “endpoint” (identified by IP address) with a file in that directory named “test.log”, where the directory is found at the top level of the root voluem?

Actually I am trying to record temperature and light smaples from wallrouter on to the file. The program I have is:

import sys
import time

Import the library from the zip file

import xbeewr
import zigbee

The Xbee Wallrouter’s hardware address

DESTINATION = “[00:13:a2:00:40:34:13:05]!”

Create a sensor object

wallrouter = xbeewr.XBeeWRN(DESTINATION)

Retrieve a sample reading from the wallrouter

for i in range (1,50):
sample = wallrouter.sample()
print “Temperature (Degrees) :”, sample[‘temperature’]
print “Light (LUX) :”, sample[‘light’]

Instead of writing these samples on the screen, I am trying to write them on a file.

To do that I was trying that little program to see if its possible to write on a file in PC connected to connectport X2 over the ethernet.

Please advice…


In your context, the “open” call attempts to open a file in the embedded filesystem of the device.

The standard “open” is not a mechanism for manipulating files across a network.

You need to consider what software will be listening for your log messages on the remote machine that receives them. That software choice will dictate what (if any) software modules would need to be incorporated to communicate. This “simple” operation is, unfortunately, not trivial.