Jump to content
We've recently updated our Privacy Statement, available here. ×

ScriptManager.ExecuteScript with json; fails. Does it use python 2.0.2

Janine Rawnsley 4

Recommended Posts

Calling a second script and passing a json string e.g. {"aaa":"bbb"}seems to break the second script and/or evaluate to a "none" type.

Has anyone managed to get this working

I've tried:

Passing the native json

Passing the result of json.dumps

Changing all "'s to ""'s


I suspecet the second script is runnign in python2.0.2. because it seems to do "nothing" if I have the line "importjson" in; whereas I can at least get a debug line of code to set a doc prop if I comment out the "importjson"

I could really do with confirmation of that if it's the case.

Link to comment
Share on other sites

Both scripts are set to use python 2.7.7


I did a bit more testing and am almost 100% sure that ScriptManager.ExecuteScript is using an older version of pythion.


It's simple enough to replicate - 


Script 1 - calls script 2 (dont even needs args)


Script 2 - have "import json" and then set a doc prop to some value.


Note that doc prop value isn't set when you run script 1, unless you comment out "import json" from script 2. No errors are returned either... you can force an error by running script 2 manually in Python version 2.0.2 at which point it complains that json isn't a valid module. I doubt this is a coincidence...



Link to comment
Share on other sites

  • 2 weeks later...

I have tried it on my end and it seems to work without any issues with the 'json' import. attached the analysis i tested with.

Also the ScriptManager.ExecuteScript Method has an override where you can pass the script language. Can you use this method to pass "IronPython277" and see if it helps


Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...