cwm uploading data to iDigi

Hi,
I have one X2 that is registered and connected to iDigi.
The goal I want to achieve is to upload one numeric value from X2 to iDigi.
I’m running the following Digi example but the message it returns is :“ImportError: No module named cwm_data”

What I’m missing?Is there a better way/example to achieve this goal?

Thanks


imports

import sys, os
import time

import the rci module to get access to the process_request method

import rci
import cStringIO
#import module needed for the send_cwm_data function
import cwm_data
#XML data that will be posted to the server
data = “”"

“”"
#name of the file that will be created on the server for the XML data
filename = “test.xml”
#name of the collection that the file will be stored in
collection = “MyCollection”
#post the XML data to the server
success, err, errmsg = cwm_data.send_cwm_data (data, filename, collection)
#print the status of the post
if success == True:
print “Success”
else:
print "Failure: ", err, " ", errmsg

Hello all,
many days haave been passed by and I’m not receiving any response to this thread.

Why?
Is there a problem?

Regards

Massimo

Hi,

For this, you need to compile cwm_data.py and put it into a zip file along with other required, python files as httplib.pyc, socket.pyc, base64.pyc, mimetools.pyc, urllib.pyc etc. So, the best way to add cwm_data.py to libs in the ESP for python project and run. So, ESP would take care of all the necessary modules to be added to the .zip file.

And import idigi_data as following way.
from libs import idigi_data

I hope this will help.

The site ‘notifications’ have not been working, so no one has known that you even posted a message (most of us don’t look daily).

cwm_data is an old obsolete file. Try editing and swapping in the “idigi_data” name instead. But as shajrj says, you do need to make sure you upload the idigi_data.py (or idigi_data.pyc) as required.

For example, my code has things like this:
success, err, errmsg = idigi_data.send_idigi_data(data, filename, collection)

Just to make sure you’re clear, you should change the line from:
import cwm_data

to:
import idigi_data

If you do not know if you have this file or where it is located, you can also do a search on your PC for “idigi_data.py” or “idigi_data.pyc”.

Also, you can search for file (a Dia presentation driver) on your PC) called “idigi_db.py” which will allow you to see how the Dia uses the same module.