Skip to content
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

Recommend renaming python file if python file it overwrites builtins #8195

Closed
DonJayamanne opened this issue Nov 5, 2021 · 1 comment · Fixed by #8237
Closed

Recommend renaming python file if python file it overwrites builtins #8195

DonJayamanne opened this issue Nov 5, 2021 · 1 comment · Fixed by #8237

Comments

@DonJayamanne
Copy link
Contributor

DonJayamanne commented Nov 5, 2021

We find that a lot of users run into this when creating python files using reserved names like sys.py/os.py/random.py.
As a result Python runtime will import the user defined files and it could fall over.

Solution:
If kernel startup fails and we detect such a scenario then recommend renaming that file.

@DonJayamanne DonJayamanne added the bug Issue identified by VS Code Team member as probable bug label Nov 5, 2021
@DonJayamanne
Copy link
Contributor Author

Solution:

  • We can detect the import error message from the stderr when kernel fails to launch
  • Ensure a python file with the name of a built exists in the stderr & exists in workspace folder (thats not in the python env)
  • If above conditions are met recommend deleting the above

This is could be the start of kernel doctor

@DonJayamanne DonJayamanne added kernel-crash and removed needs-triage bug Issue identified by VS Code Team member as probable bug labels Nov 5, 2021
@DonJayamanne DonJayamanne changed the title Recommend deleting python file if python file overwrites builtins Recommend renaming python file if python file it overwrites builtins (recommend not using reserved names) Nov 5, 2021
@DonJayamanne DonJayamanne changed the title Recommend renaming python file if python file it overwrites builtins (recommend not using reserved names) Recommend renaming python file if python file it overwrites builtins Nov 5, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
1 participant