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

name '__file__' is not defined when using os/sys #6120

Open
danielreispereira opened this issue Jan 24, 2025 · 0 comments
Open

name '__file__' is not defined when using os/sys #6120

danielreispereira opened this issue Jan 24, 2025 · 0 comments

Comments

@danielreispereira
Copy link

The following works fine on a clean VSCode :

import os 
import sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

But it fails on Positron with the following error

NameError: name '__file__' is not defined
Cell In[5], line 1
----> 1 sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant