-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failed to detect AST nodes in Windows ipython for verb calls #170
Comments
Could you also indicate the environment where you were running the code? i.e. python script, jupyter, python REPL, etc |
For sure @pwwang , I'm using in a .py file in VScode (via its Interactive Window, which uses jupyter kernel). |
I can run it with no problem: here is the version info:
|
The problem was indeed with VScode, I updated it to the last version and that warning message disappeared, thank you @pwwang . |
@pwwang , I checked that the issue was solved only for python 3.8 (after I updated datar and restarted VScode). |
Steps to reproduce the issue.
Then run: import datar.all as d
import pandas as pd
new_name = "y"
pd.DataFrame(dict(x=[2])) >> d.rename(**{new_name: 'x'}) It will display this message:
|
This is expected. Tracing executing node is not available in the raw python REPL. |
I could not install |
Maybe an option to temporarily silent that message would suffice as a workaround (in the context of a function, we could turn off in the beginning and turn on in the end). |
You can silence it by: pd.DataFrame(dict(x=[2])) >> d.rename(**{new_name: 'x'}, __ast_fallback="piping") It's kinda wired that ipython shows the same issue. Could you provide |
Awesome,
For sure:
The python version installed on my Windows OS is 3.9.4. |
Sorry, I meant ipython. |
# importing ...
d.rename.ast_fallback = "piping"
# So you don't need to pass "__ast_fallback" to every call
new_name1 = 'y'
new_name2 = 'z'
pd.DataFrame(dict(x=[2])) >> d.rename(**{new_name1: 'x'})
pd.DataFrame(dict(x=[2])) >> d.rename(**{new_name2: 'x'}) |
Very nice to know. |
The ipython version is 8.8.0 |
Looks like the only difference is the platform. I can reproduce the issue on Windows. The snapshot I took was on Linux (WSL). |
Looks like it is due to a python bug on Windows. AST nodes cannot be detected when we are trying to deconstruct dicts as keyword-arguments. new_name = 'y'
# Warns
pd.DataFrame(dict(x=[2])) >> d.rename(**{new_name: 'x'})
# But this is Okay
pd.DataFrame(dict(x=[2])) >> d.rename(y='x') Related: alexmojaki/executing#27 |
Great, at least now we know the root cause. |
Close it for now since this problem can not be solved in this repo. A temporarily solution is to pass pd.DataFrame(dict(x=[2])) >> d.rename(**{new_name: 'x'}, __ast_fallback="piping") See more details here: https://pwwang.github.io/pipda/piping/#fallbacks-when-ast-node-detection-fails |
Feature Type
Adding new functionality to datar
Changing existing functionality in datar
Removing existing functionality in datar
Problem Description
The code below
generates the following warning message:
Feature Description
Being able to suppress the warning message above.
Additional Context
No response
The text was updated successfully, but these errors were encountered: