Closed williamjamir closed 6 years ago
This same error happens in this situation too:
test.py
from a.b import c
def oi(self):
foo = c
Script.py:
with open('test.py', mode='r') as file:
tree = pasta.parse(file.read())
rename.rename_external( tree , 'a.b.c' , 'foo.b.d' )
Log:
Traceback (most recent call last):
File "s2.py", line 18, in <module>
rename.rename_external(tree, 'a.b.c', 'foo.b.c')
File "w:\william\repo_pasta\pasta\augment\rename.py", line 92, in rename_external
_rename_reads(sc, t, rename_old, rename_new)
File "w:\william\repo_pasta\pasta\augment\rename.py", line 153, in _rename_reads
ast.parse(new_name).body[0].value)
File "w:\william\repo_pasta\pasta\base\ast_utils.py", line 240, in replace_child
field_val[field_val.index(node)] = replace_with
ValueError: <_ast.Name object at 0x00000000051A8048> is not in list
Thanks for reporting it!
Hi,
Running the rename_external on the following file
test.py
causes aValueError: <_ast.Name object at 0x0000000005322F98> is not in list
File: test.py
Log:
Script:
cc @nicoddemus