"VarnameRetrievingError: Unable to retrieve the ast node." / "VarnameRetrievingError: Cannot retrieve the node where the function is called."
jamesphillipturpin opened this issue · 1 comments
OK, so I'm running this on Windows 11 so maybe that is part of the problem? Anyway, I don't get very far along in your example usage from the README before I get an error. I get similar errors when I'm just poking around, doing almost anything I would want this module for.
`
C:\Python311>python
Python 3.11.3 (tags/v3.11.3:f3909b8, Apr 4 2023, 23:49:59) [MSC v.1934 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
from varname import varname
def function():
... return varname()
...
func = function() # func == 'func'
Traceback (most recent call last):
File "", line 1, in
File "", line 2, in function
File "C:\Python311\Lib\site-packages\varname\core.py", line 108, in varname
raise VarnameRetrievingError("Unable to retrieve the ast node.")
varname.utils.VarnameRetrievingError: Unable to retrieve the ast node.
`
So here is my own example to show the partial functionality of the module:
`
C:\Python311>python
Python 3.11.3 (tags/v3.11.3:f3909b8, Apr 4 2023, 23:49:59) [MSC v.1934 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
import varname
x=2
varname.nameof(x)
'x'
def f(foo):
... print(varname.nameof(foo))
... print(varname.argname(foo))
...
f(x)
foo
Traceback (most recent call last):
File "", line 1, in
File "", line 3, in f
File "C:\Python311\Lib\site-packages\varname\core.py", line 446, in argname
raise VarnameRetrievingError(
varname.utils.VarnameRetrievingError: Cannot retrieve the node where the function is called.
`
See #86 (comment)