cozmo-python-sdk
cozmo-python-sdk copied to clipboard
TclError: no display name and no $DISPLAY environment variable
While trying to run the vision tutorial codes, I encountered the following error with every .py file in the 03_vision folder:
Traceback (most recent call last):
File "03_vision/02_face_follower.py", line 60, in <module>
cozmo.run_program(follow_faces, use_viewer=True, force_viewer_on_top=True)
File "/mnt/e/coding/venvs/soar/lib/python3.5/site-packages/cozmo/run.py", line 847, in run_program
force_on_top=force_viewer_on_top)
File "/mnt/e/coding/venvs/soar/lib/python3.5/site-packages/cozmo/run.py", line 716, in connect_with_tkviewer
viewer = tkview.TkImageViewer(force_on_top=force_on_top)
File "/mnt/e/coding/venvs/soar/lib/python3.5/site-packages/cozmo/tkview.py", line 80, in __init__
tk_root = tkinter.Tk()
File "/usr/lib/python3.5/tkinter/__init__.py", line 1871, in __init__
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: no display name and no $DISPLAY environment variable
It's obviously caused by the programs trying to display the camera readout through Tkinter, since if I set the use_viewer
parameter to False
in the cozmo.run_program()
call the error disappears and the code works as expected. Googling gave me lots of results for matplotlib issues with this error, which are apparently solved by setting the graphics backend to "agg", but I'm not sure how to do that with the Cozmo SDK, Any insight would be appreciated.