NameError: name'__file__' is not defined

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__"))

Recommended Posts

NameError: name'__file__' is not defined
[Python] Name Error: name'urlparse' is not defined
Python round is not strictly round
Is time.time () not very accurate?
TypeError:'int' object is not subscriptable
Python list is not a list
NameError: global name'dot_parser' is not defined and what to do when it comes up in python
[Django error]'RenameAttributes' object is not iterable
Multiplicative hash is not perfect (proven)
Sympy Laplace transform is not practical