Python error name '__file__' is not defined

Describes the cause and action for error messages.


Error Message(English):
error name '__file__' is not defined

Resolution


関連リンク


絶対パスの取得「__file__」 - Qiita
https://qiita.com/opankopan/items/42a78754aa2fe6b6a29f

NameError: name '__file__' is not defined - Qiita
https://qiita.com/zabeth129/items/dea3f71efd90546a2605

python NameError: global name '__file__' is not defined - Stack ...
https://stackoverflow.com/questions/16771894/python-nameerror-global-name-file-is-not-defined

python '__file__' is not defined
https://stackoverflow.com/questions/19630634/python-file-is-not-defined

python NameError: name '__file__' is not defined
https://stackoverflow.com/questions/24140593/python-nameerror-name-file-is-not-defined

python '__file__' is not defined in thread
https://stackoverflow.com/questions/35915852/python-file-is-not-defined-in-thread

How do I get the path of the current executed file in Python ...
https://stackoverflow.com/questions/2632199/how-do-i-get-the-path-of-the-current-executed-file-in-py・・・

os.chdir(os.path.dirname(os.path.realpath(__file__)))でエラーが出ます
https://ja.stackoverflow.com/questions/37608/os-chdiros-path-dirnameos-path-realpath-file-%E3%81%A7%・・・

py2exeにて__file__が使えない問題と解決方法 | めーゆーのメモ帳
http://meyu.biz/2015/03/py2exe__file__/

Python - is not definedが解決できない|teratail
https://teratail.com/questions/106907



Name:
Comment:



[return to Python エラーコード一覧]