logo       

FW: problem with dictionaries (fwd): msg#00060

lang.jython.user

Subject: FW: problem with dictionaries (fwd)


Hi Shweta,

Shweta, please don't email me directly when you're looking for
Python/Jython help. It is not that I don't like getting email; it's just
that I simply can't guarantee that I'll give you a good answer quickly!
I'm actually out of town at the moment.

It's much better to send your questions to a mailing list like the
Jython-users mailing list, or Python-Tutor. Your question looks
Jython-specific, so I will forward your question to the Jython-users
mailing list for your convenience.


---------- Forwarded message ----------
Date: Thu, 27 Feb 2003 20:11:52 +0530
From: Shweta Kesarwani <Shweta_K@xxxxxxxxxxx>
To: dyoo@xxxxxxxxxxxxxxxxxxxxx
Cc: MOHANKS <MOHANKS@xxxxxxxxxxx>
Subject: FW: problem with dictionaries

Hi
We have been contacting you for some time for our queries related to
Python.
Now I need your help on jython.
Please have a look at my problem stated below.

I wrote two python files viz dependencies.py & test.py
The depedencies.py file contents are:

import os,sys,string
import java
class dependencies(java.lang.Object):
global services
services = {
'srvc_a': {'depends_on' :"srvc_b,srvc_c"},
'srvc_b': {'depends_on' :"srvc_d,srvc_e"},
'srvc_c': {'depends_on' :"srvc_f"},
'srvc_d': {'depends_on' :''},
'srvc_e': {'depends_on' :''},
'srvc_f': {'depends_on' :''},
}

The contents of the test.py file are:
import os,sys,string
import java
class test(java.lang.Object):
def dict_list(self):
"""@sig void dict_list()"""
# to instantiate the class dependencies of the module dependencies
a = dependencies.dependencies()
for key in a.services.keys() :
print key,
print ( "depends on " + a.services[key]['depends_on'] )


The problem was that when I tried to runthis script thru jython [ by
instatiating an object of the class test & calling the method
dict_list()
as
b= test()
b.dict_list()

then it works fine and shows the list

But if I call this method dict_list in a java code [ removing the above
two lines from test.py & compiling both test.py & dependencies.py wiith
jythonc ]
and run that java class file ,then it gives attribute error
saying that "class dependencies does not have an attribute named
dependencies"

public class testTest
{
public static void main(String[] args)
{
test a = new test();
a.dict_list();
}
}
[the jpywork directory was included in the classpath]

Looking forward to getting some guidance from you.

Regards
Shweta Kesarwani
Infosys Technologies Ltd.
Contact at :6588668(Extn.1472)

Be careful of your thoughts; they may become words at any moment. --
Iara Gassen





-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise