LoginSignup
16
6

More than 5 years have passed since last update.

NameError: name '__file__' is not defined

Posted at

NameError: name 'file' is not defined

You'll have the error if you write the following code at console.

os.path.dirname(os.path.abspath(__file__))

change your code as follows

os.path.dirname(os.path.abspath("__file__"))
16
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
16
6