Error messages

From Digi Developer

Jump to: navigation, search

Contents

Common error messages

Many error messages are misleading, as the messages are from secondary causes. Document such messages and the results here:

Bad Local File Header

#> py dia.py

Determining platform type...Digi Python environment found.

Traceback (most recent call last):
  File "<string>", line 161, in ?
  File "<string>", line 82, in main
zipimport.ZipImportError: bad local file header in WEB/python/dia.zip

The most likely cause is that the zip file has already been opened, and you are trying to open a 'new version' a second time. You need to reboot after uploading a new copy of the ZIP file.

For example, if dia.py is already running, then you'll always get this error. Check the 'connections' or 'who' list. Perhaps you left it running before, or have it set to auto-run.

A secondary cause might be a bad ZIP image - HTTP/Web upload is not totally reliable. At times large files timeout/abort during upload and you may end up with only 320K of a 350K file. So confirm the file size of the ZIP is as expected, and/or upload dia.zip again.

Error Workaround
As a workaround for this error without needing to reboot, one can clear zipimport's cached file headers. As part of one's startup script (before zip files are loaded onto sys.path call the following):

def clear_zipimport_cache():
    """Clear out cached entries from _zip_directory_cache"""
    import sys, zipimport
    syspath_backup = list(sys.path)
    zipimport._zip_diretory_cache.clear()
 
    # load back items onto sys.path
    sys.path = syspath_backup

Exception while uploading

Literally, the message each time DIA tried to upload data was the following:

iDigi_DB(idigi_db1): exception while uploading: (-6, 'The name does not resolve 
for the supplied parameters. Neither nodename  nor servname were supplied. At 
least one of these must be supplied.')

The solution (or problem) was that the DNS IP addresses within the CPX4 were NOT set properly, thus the remote management server name (sd1-na.idigi.com) could not be resolved, thus Device Cloud was NOT connected.

Other symptoms:

  • Device Cloud (or connectware manager) listed the device as disconnected.
  • the web UI connections page did not list the "connectware tcp" entry

Socket.error

Socket is already open

Traceback <most recent call last>:
File "<string>", line 23, in ?
File "<string>", line 1, in bind
socket.error: <22, 'invalid argument'>

Although this error could mean a badly formed IP or port value, it also can mean that some other Python script is running and holding that specific IP+port combination open. Navigate to your ConnectPort's WebUI, click on Applications->Python->Auto-start Settings, uncheck whichever script may be set to autorun, click Apply and reboot your gateway.

Syntax Error (in YML file)

A very common cause is the use of tab characters. YML requires spaces only, so either use a text editor which replaces tabs with spaces, or manually make sure only spaces are use.

ValueError: failed to parse request (in RCI call)

One cause for this is 'fancy quotes' - if you cut and paste the request from a PDF or other web document, at times the quotations used are the fancy 'angled' quotes. Thus the string <rci_request version="1.1"> is really seen as <rci_request version=ö1.1ö>, which causes the RCI call to fail.

list index out of range error

A node which was part of the "index" is no longer available

#> python EmbeddedKitService.py

Starting up...
Ready for incoming requests!
Discovering nodes...
Exception in thread WPANSerialEndpoint:
Traceback <most recent call last>:
  File "WEB/python/python.zip/threading.py", line 442, in __bootstrap
  File "WEB/python/EmbeddedKitManager.py", line 199, in run
    nodes = self.get_bindings_hash_list<>
  File "WEB/python/EmbeddedKitManager.py", line 496, in get_bindings_hash_list
    hash_list = [self._bindings.bindings[k].to_hash<> \
  File "WEB/python/EmbeddedKitManager.py", line 38, in to_hash
    return {
IndexError: list index out of range

-

This error typically means that a node which was once associated with the parent (CP-X?) where the python script is running is no longer available. Common causes: node has been configured for sleep parameters and is now asleep, node is powered off, node is in an unknown state. Power off parent and all associated nodes to clear out routing and neighbor tables, then power them back on and re-try the script when the nodes are available.

Personal tools
Wiki Editing