You probably want to take a copy of interp.py and modify it so that when a dictionary is returned, you return something like the Python.Dictionary object (see win32com\servers\dictionary.py). You can create such an object via something like:
>>> from win32com.servers.dictionary import DictionaryPolicy >>> from win32com.server.util import wrap >>> ob = wrap({"foo":"bar"}, usePolicy=DictionaryPolicy) >>> ob <PyIDispatch at 0x01507A88 with obj at 0x01511620> If interp.py returned 'ob', VB should be able to access it somewhat like a regular VB collection - so instead of simply: return eval(str(exp), self.dict) you checked the result, and if it's a dict, execute the lines above and return 'ob' instead of the dict (and obviously using a real dict instead of the constant one in the example above) Hope this helps (and works ;) Mark From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Janakiraman Mohanakrishnan Sent: Tuesday, 5 February 2008 4:48 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED]; python-win32@python.org Subject: Re: [python-win32] Executing eval function in VBscript yes i want to have python functionality in excel, iam trying to call python functions from VBscript, more like evaluating a python expression say dictionary or list in VBscript For evaluating a python expression , python has some library functions like eval which takes python expressions in string format and checks whether it is a valid python expression or not so i thought of calling that python eval function in VBscript and validate my datas but the problem is when i tried to pass dictionaries for eg, "{'key':value}" this is the format of dictionary in python VBscript throws error like type mismatch since VB dictionary representation of VB and python are different Thanks and Regards! "Tony Cappellini" <[EMAIL PROTECTED]> 02/05/2008 01:51 AM Please respond to [EMAIL PROTECTED] To python-win32@python.org cc [EMAIL PROTECTED], [EMAIL PROTECTED] Subject [python-win32] Executing eval function in VBscript Date: Mon, 04 Feb 2008 10:05:11 -0500 From: bob gailer <[EMAIL PROTECTED]> Subject: Re: [python-win32] Executing eval function in VBscript To: Janakiraman Mohanakrishnan <[EMAIL PROTECTED]> Cc: python-win32@python.org Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset=ISO-8859-1; format=flowed >>That's hard to answer until we know what you want to accomplish! Tell us >>more. What problem are you trying to solve? I think he wants to have python functionality from excel, which is what I'd like to accomplish as well. (Python embedded into excel, as opposed to launching Excel from Python) >>Also I'm not very familiar with MSScriptControl. I googled it and found >>no useful documentation. Do you have any references to it? Everything you want to know about the MSScriptControl is on microsoft's site. ForwardSourceID:NT0000976E =====-----=====-----===== Notice: The information contained in this e-mail message and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank you
_______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32