wkentaro / labelme

Image Polygonal Annotation with Python (polygon, rectangle, circle, line, point and image-level flag annotation).
https://labelme.io
Other
13.64k stars 3.42k forks source link

if self._config[dock]['closable']: TypeError: 'NoneType' object is not subscriptable #1239

Open zombieMaybeLikeCake opened 1 year ago

zombieMaybeLikeCake commented 1 year ago

Provide environment information

Python 3.5.6 :: Anaconda, Inc. certifi (2020.6.20) cycler (0.10.0) kiwisolver (1.1.0) labelme (3.16.2) matplotlib (3.0.3) numpy (1.18.5) olefile (0.46) Pillow (5.2.0) pip (20.3.4) pyparsing (2.4.7) PyQt5 (5.15.2) PyQt5-sip (12.9.1) python-dateutil (2.8.2) PyYAML (5.3.1) QtPy (1.9.0) setuptools (40.2.0) six (1.16.0) termcolor (1.1.0) wheel (0.37.1) wincertstore (0.2)

What OS are you using?

windows 10

Describe the Bug

Traceback (most recent call last): File "c:\users\robert.conda\envs\labelme\lib\runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "c:\users\robert.conda\envs\labelme\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "C:\Users\robert.conda\envs\labelme\Scripts\labelme.exe__main.py", line 9, in File "c:\users\robert.conda\envs\labelme\lib\site-packages\labelme\main.py", line 164, in main output_dir=output_dir, File "c:\users\robert.conda\envs\labelme\lib\site-packages\labelme\app.py", line 166, in init__ if self._config[dock]['closable']: TypeError: 'NoneType' object is not subscriptable

Expected Behavior

No response

To Reproduce

conda create–name=labelme python=3.9

conda activate labelme

pip install pyqt5

conda install pillow pip install labelme==3.16.2

ignpaub commented 1 year ago

I have finally an answer that avoids the error from above. The labelmerc file from #551 did not work for me. I tried with another one (you can find it down here) and I got it working.

The used dependencies are the following:

The .labelmerc file should be copied in / and should have the following content.

auto_save: false
display_label_popup: true
store_data: true
keep_prev: false
keep_prev_scale: false
logger_level: info

flags: null
label_flags: null
labels: null
file_search: null
sort_labels: true
validate_label: null

default_shape_color: null
shape_color: auto   # null, 'auto', 'manual'
shift_auto_shape_color: 0
label_colors: null

# main
flag_dock:
  show: true
  closable: true
  movable: true
  floatable: true
label_dock:
  show: true
  closable: true
  movable: true
  floatable: true
shape_dock:
  show: true
  closable: true
  movable: true
  floatable: true
file_dock:
  show: true
  closable: true
  movable: true
  floatable: true

# label_dialog
show_label_text_field: true
label_completion: startswith
fit_to_content:
  column: true
  row: false

# canvas
epsilon: 10.0
canvas:
  # None: do nothing
  # close: close polygon
  double_click: close

shortcuts:
  close: Ctrl+W
  open: Ctrl+O
  open_dir: Ctrl+U
  quit: Ctrl+Q
  save: Ctrl+S
  save_as: Ctrl+Shift+S
  save_to: null
  delete_file: Ctrl+Delete

  open_next: [D, Ctrl+Shift+D]
  open_prev: [A, Ctrl+Shift+A]

  zoom_in: [Ctrl++, Ctrl+=]
  zoom_out: Ctrl+-
  zoom_to_original: Ctrl+0
  fit_window: Ctrl+F
  fit_width: Ctrl+Shift+F

  create_polygon: Ctrl+N
  create_rectangle: Ctrl+R
  create_circle: null
  create_line: null
  create_point: null
  create_linestrip: null
  edit_polygon: Ctrl+J
  delete_polygon: Delete
  duplicate_polygon: Ctrl+D
  undo: Ctrl+Z
  undo_last_point: [Ctrl+Z, Backspace]
  add_point_to_edge: Ctrl+Shift+P
  edit_label: Ctrl+E
  toggle_keep_prev_mode: Ctrl+P
jessie900309 commented 9 months ago

Sorry if I make any mistake in my english.

I followed your instructions to add .labelmerc in the anaconda3\envs\labelme\Lib\site-packages\labelme directory, but I still encounter the following error when executing labelme:


  File "C:\Users\zombie\anaconda3\envs\labelme\Scripts\labelme-script.py", line 9, in <module>
    sys.exit(main())
             ^^^^^^
  File "C:\Users\zombie\anaconda3\envs\labelme\Lib\site-packages\labelme\__main__.py", line 172, in main
    win = MainWindow(
          ^^^^^^^^^^^
  File "C:\Users\zombie\anaconda3\envs\labelme\Lib\site-packages\labelme\app.py", line 197, in __init__
    if self._config[dock]["closable"]:
       ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
TypeError: 'NoneType' object is not subscriptable```