Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 11-16-2005
JavaJack JavaJack is offline
Registered User
 
 
Join Date: Nov 2005
Posts: 2
Python interactive mode - invalid value for element 0

I'm trying to mimic the simple printer example, with my own dummy.ice file:

module Dummy {
struct geo {
int tsn;
string geographicvalue;
string updatedate;
string dummy;
};
sequence<geo> geolist;
interface geoops {
geolist getgeolist();
};
};

Then I tried to create a server and client in two separate python interactive prompts by following the same steps as simpleprinter:

SERVER:
>>> import Ice
>>> i = Ice.initialize()
>>> Ice.loadSlice("dummy.ice")
>>> import Dummy
>>> class geoopsi(Dummy.geoops):
... def getgeolist(self, current=None):
... return (1,"geoval", "1/1/1", "x")
>>> a = i.createObjectAdapterWithEndpoints("geoadapter", "default -p 10000")
>>> s = geoopsi()
>>> a.add(s, Ice.stringToIdentity("crap"))
crap -t:tcp -h 192.168.1.100 -p 10000
>>> a.activate()


CLIENT:
>>> import Ice
>>> Ice.loadSlice("dummy.ice")
>>> import Dummy
>>> i = Ice.initialize()
>>> b = i.stringToProxy("crap:default -p 10000")
>>> d = Dummy.geoopsPrx.checkedCast(b)
>>> d.getgeolist()


ERROR:
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "dummy.ice", line 78, in getgeolist

Ice.UnknownException: exception ::Ice::UnknownException
{
unknown = exceptions.ValueError: invalid value for element 0 of `::Dummy::geolist'
}

I must be overlooking something simple, can anyone spot the problem?

One odd thing is that I _can_ call the function in the server's cmd window:
>>> s.getgeolist()
(1, 'geoval', '1/1/1', 'x')
__________________
R. Alan Monroe
Home user
http://javajack.dynalias.net/
Reply With Quote
  #2 (permalink)  
Old 11-16-2005
mes's Avatar
mes mes is offline
ZeroC Staff
 
Name: Mark Spruiell
Organization: ZeroC, Inc.
Project: Ice Developer
 
Join Date: Feb 2003
Location: California
Posts: 971
Welcome to the forum!

The UnknownException indicates that the problem is in the server, and the error message points out that there's a type mismatch with a sequence element. The problem is in the following code:
Code:
def getgeolist(self, current=None):
    return (1,"geoval", "1/1/1", "x")
The return value of this operation is declared as a sequence of struct, and Ice maps a Slice struct to a Python class. You need to allocate a geo member like this:
Code:
def getgeolist(self, current=None):
    return (geo(1,"geoval", "1/1/1", "x"),)
Also notice the extra trailing comma, which is necessary for the parser to treat this as a sequence of one element.

Take care,
- Mark
Reply With Quote
  #3 (permalink)  
Old 11-16-2005
JavaJack JavaJack is offline
Registered User
 
 
Join Date: Nov 2005
Posts: 2
Quote:
Originally Posted by mes
Code:
def getgeolist(self, current=None):
    return (geo(1,"geoval", "1/1/1", "x"),)
Cool, that worked - although I had to fully qualify geo as Dummy.geo Thanks.
__________________
R. Alan Monroe
Home user
http://javajack.dynalias.net/
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
icegridnode can't start on daemon mode ? ewiniar Help Center 2 05-29-2006 06:24 AM
problems with AIX in 64bit mode peter.s Help Center 5 05-18-2006 06:05 PM
For mode publish&subscribe terminate Help Center 1 02-10-2006 12:55 AM
How to detect an invalid proxy? ssergei Help Center 11 02-09-2005 05:41 AM
OpenSSLPluginI.cpp, invalid static cast on FreeBSD rodrigc Patches 0 02-27-2003 01:08 PM


All times are GMT -4. The time now is 10:02 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
(c) 2008 ZeroC, Inc.