0
나는 연결된 사용자의 목록을 갖고 싶습니다. 대화 상자 tui를 선택했습니다. 이것은 첫 번째 작은 파이썬 (3.5) 스크립트입니다.대화 상자의 선택 사항에 변수를 전달하는 방법은 무엇입니까?
import sys
import psutil
import locale
import dialog
import pprint
locale.setlocale(locale.LC_ALL, '')
d = dialog.Dialog(dialog="dialog")
choices = []
i = 0;
users = psutil.users()
for user in users:
item = ('{0}.'.format(i), user.name)
choices.append(item)
i += 1
choices.append(('X', "Exit"))
#pprint.pprint(choices)
#OUTPUT: [('0.', 'root'), ('1.', 'root'), ('X', 'Exit')]
#code, tag = d.menu("List", choices)
code, tag = d.menu("List", choices=[('0.', 'root'), ('1.', 'root'), ('X', 'Exit')])
내 질문은, 왜 선택과 대화 작품 인라인 정의되어 있지만 난 그냥 인라인 정의에 제공된 목록과 동일 이미 정의 된 목록을 제공 할 수없는 경우이다.
child_output.strip()))
dialog.DialogError: dialog-like terminated due to an error: the dialog-like program exited with status 3 (which was passed to it as the DIALOG_ERROR environment variable). Sometimes, the reason is simply that dialog was given a height or width parameter that is too big for the terminal in use. Its output, with leading and trailing whitespace stripped, was:
Error: Expected at least 6 tokens for --menu, have 4.