pycharm console error - resolve_var

已回答

pycharm console gives the following error after executing each command: 

Traceback (most recent call last):
File "C:\Program Files\JetBrains\PyCharm Community Edition 2017.3.3\helpers\pydev\_pydevd_bundle\pydevd_vars.py", line 256, in resolve_var
return resolver.get_dictionary(var)
AttributeError: 'NoneType' object has no attribute 'get_dictionary'

OS: Windows 7

Python 3.5.2

Anaconda 4.2.0 (64-bit)
IPython 6.2.0

Any help in resolving this error?

Thanks!

0

Hi! Could you please provide us a command to reproduce the problem?

0
Avatar
Permanently deleted user

Having the same issue, get the error below when running any command in the console. However, the commands do seem to execute, e.g.

>>>x=1
Traceback (most recent call last):
File "/snap/pycharm-community/76/helpers/pydev/_pydevd_bundle/pydevd_vars.py", line 289, in resolve_compound_var_object_fields
return resolver.get_dictionary(var)
AttributeError: 'NoneType' object has no attribute 'get_dictionary'
>>>print(x+1)
2
Traceback (most recent call last):
File "/snap/pycharm-community/76/helpers/pydev/_pydevd_bundle/pydevd_vars.py", line 289, in resolve_compound_var_object_fields
return resolver.get_dictionary(var)
AttributeError: 'NoneType' object has no attribute 'get_dictionary'

 

OS: Ubnutu 16.04
Python 2.7 (venv) project interpret

PyCharm 2018.2.1 (Community Edition)
Build #PC-182.3911.33, built on August 5, 2018
JRE: 1.8.0_152-release-1248-b8 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.4.0-131-generic

0
Avatar
Permanently deleted user

So I was also getting this error, and I couldn't understand why.  So I ended up editing my pydevd_vars.py file in the PyCharm Application.

 

I changed the function

def resolve_compound_var_object_fields(var, attrs):
"""
Resolve compound variable by its object and attributes

:param var: an object of variable
:param attrs: a sequence of variable's attributes separated by \t (i.e.: obj\tattr1\tattr2)
:return: a dictionary of variables's fields
"""
attr_list = attrs.split('\t')

for k in attr_list:
type, _typeName, resolver = get_type(var)
var = resolver.resolve(var, k)

try:
type, _typeName, resolver = get_type(var)
return resolver.get_dictionary(var)
except:
traceback.print_exc()

To

def resolve_compound_var_object_fields(var, attrs):
"""
Resolve compound variable by its object and attributes

:param var: an object of variable
:param attrs: a sequence of variable's attributes separated by \t (i.e.: obj\tattr1\tattr2)
:return: a dictionary of variables's fields
"""
attr_list = attrs.split('\t')

for k in attr_list:
type, _typeName, resolver = get_type(var)
var = resolver.resolve(var, k)

try:
type, _typeName, resolver = get_type(var)
if resolver:
return resolver.get_dictionary(var)
else:
return {}
except:
traceback.print_exc()

 

I don't know if there are any adverse effects of this change, and it will likely be whipped out when I update PyCharm, but the issue seems to be resolved.  I hope this helps someone.

0

请先登录再写评论。