在linux下,我使用IronPython 2.6.10920.0 on .NET 4.0.30319.1作为HFSS现场仿真软件的一部分。对于json模块,我遇到了一个奇怪的问题:
>>>import json
>>>print json.dumps('foo')
'"foo"'
>>>print json.loads('"foo"')
MissingMemberException: 'NoneType' object has no attribute 'scanner'可能是什么原因?我怎么才能让它起作用呢?
UPD:当我将上面的代码包装到try: .. except .., e: print e中时,我得到了如下输出:
System.MissingMemberException: 'NoneType' object has no attribute 'scanner'
at (wrapper dynamic-method) object:CallSite.Target (System.Runtime.CompilerServices.Closure,System.Runtime.CompilerServices.CallSite,object,IronPython.Runtime.CodeContext)
at Microsoft.Scripting.Interpreter.DynamicInstruction`3[System.Object,IronPython.Runtime.CodeContext,System.Object].Run (Microsoft.Scripting.Interpreter.InterpretedFrame frame) [0x00000] in <filename unknown>:0
at Microsoft.Scripting.Interpreter.Interpreter.RunInstructions (Microsoft.Scripting.Interpreter.InterpretedFrame frame) [0x00000] in <filename unknown>:0
at Microsoft.Scripting.Interpreter.Interpreter.Run (Microsoft.Scripting.Interpreter.InterpretedFrame frame) [0x00000] in <filename unknown>:0 他想跟我说些什么?
发布于 2014-09-09 08:15:34
我不知道json模块在2.6中是否有效。如果可以的话,可以试试升级至2.7,在json工作的地方。
https://stackoverflow.com/questions/25647666
复制相似问题