No such device found

Hi,

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

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

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

After running the code, I am getting the error,

IOError: [Errno 19] No such device: ‘/134.17.36.245/test.log’

Please help me with this code…

Ummi

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
sys.path.append(“WEB/python/DigiXBeeDrivers.zip”)

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’]
print
time.sleep(1800)

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…

Ummi

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.