Lets say we have some python dictionary and we have a VBScript. We are going to call the script in python and pass the dictionary as an argument like this:
import subprocess
dict = {}
dict ["x61"] = "P11"
dict ["x62"] = "P22"
dict ["x63"] = "P33"
subprocess.call(['cscript.exe', 'H:\\public\\vbscript.vbs', dict])
In the VBScript I am trying to assign the dictionary like this:
Dim dict
dict = WScript.Arguments(0)
The (error) output that I get in the terminal is:
required: 'x61x63x62'
May be because I am looping and trying to access all items in the dict:
dict.Item(some_variable)
Shall I serialize the dict object and how can I do it?
call's first argument can only contain strings. I suggest serializing the dictionary in a way that VB can decode later. Maybe Json?