下記のようなエラーがでます。何がいけないのでしょうか。
Shell
%Run camera.py
Traceback (most recent call last):
File “/home/newpiuser/mimamori/camera.py”, line 13, in
DATA_PATH = os.environ[‘DATA_PATH’]
File “/usr/lib/python3.7/os.py”, line 678, in getitem
raise KeyError(key) from None
KeyError: ‘DATA_PATH’
Assistant
KeyError: ‘DATA_PATH’
os.py, line 678
No specific suggestions for this error (yet).
Let Thonny developers know
Click on the feedback link at the bottom of this panel to let Thonny developers know about your problem. They may add support for such cases in future Thonny versions.
Search the web
Try performing a web search for
Python KeyError: ‘DATA_PATH’
Warnings
May help you find the cause of the error.
camera.py
Line 9 : Unused date imported from datetime
It looks like the imported module or variable is not used.
Line 58 : Redefining name ‘frame’ from outer scope (line 182)
It looks like the local variable is hiding a global variable with the same name.
Most likely there is nothing wrong with this. I just wanted to remind you that you can’t access the global variable like this. If you knew it then please ignore the warning.
If you don’t want to see this reminder in the future, then add “redefined-outer-name” (without quotes) into “Tools → Options → Assistant → Disabled checks”.
Line 74 : Redefining name ‘num_persons’ from outer scope (line 186)
It looks like the local variable is hiding a global variable with the same name.
Most likely there is nothing wrong with this. I just wanted to remind you that you can’t access the global variable like this. If you knew it then please ignore the warning.
If you don’t want to see this reminder in the future, then add “redefined-outer-name” (without quotes) into “Tools → Options → Assistant → Disabled checks”.
Line 106 : Redefining name ‘num_persons’ from outer scope (line 186)
It looks like the local variable is hiding a global variable with the same name.
Most likely there is nothing wrong with this. I just wanted to remind you that you can’t access the global variable like this. If you knew it then please ignore the warning.
If you don’t want to see this reminder in the future, then add “redefined-outer-name” (without quotes) into “Tools → Options → Assistant → Disabled checks”.
Line 109 : Redefining name ‘f’ from outer scope (line 42)
It looks like the local variable is hiding a global variable with the same name.
Most likely there is nothing wrong with this. I just wanted to remind you that you can’t access the global variable like this. If you knew it then please ignore the warning.
If you don’t want to see this reminder in the future, then add “redefined-outer-name” (without quotes) into “Tools → Options → Assistant → Disabled checks”.
Line 121 : Redefining name ‘start_time’ from outer scope (line 170)
It looks like the local variable is hiding a global variable with the same name.
Most likely there is nothing wrong with this. I just wanted to remind you that you can’t access the global variable like this. If you knew it then please ignore the warning.
If you don’t want to see this reminder in the future, then add “redefined-outer-name” (without quotes) into “Tools → Options → Assistant → Disabled checks”.
Line 121 : Redefining name ‘end_time’ from outer scope (line 172)
It looks like the local variable is hiding a global variable with the same name.
Most likely there is nothing wrong with this. I just wanted to remind you that you can’t access the global variable like this. If you knew it then please ignore the warning.
If you don’t want to see this reminder in the future, then add “redefined-outer-name” (without quotes) into “Tools → Options → Assistant → Disabled checks”.
Line 125 : Redefining name ‘f’ from outer scope (line 42)
It looks like the local variable is hiding a global variable with the same name.
Most likely there is nothing wrong with this. I just wanted to remind you that you can’t access the global variable like this. If you knew it then please ignore the warning.
If you don’t want to see this reminder in the future, then add “redefined-outer-name” (without quotes) into “Tools → Options → Assistant → Disabled checks”.
Line 141 : Redefining name ‘seconds’ from outer scope (line 174)
It looks like the local variable is hiding a global variable with the same name.
Most likely there is nothing wrong with this. I just wanted to remind you that you can’t access the global variable like this. If you knew it then please ignore the warning.
If you don’t want to see this reminder in the future, then add “redefined-outer-name” (without quotes) into “Tools → Options → Assistant → Disabled checks”.
Was it helpful or confusing?
General advice on dealing with errors.