Nach einer Weile mit dem Cmd.cmd Framework in Python 3.6 auf Mac OS, habe ich ein Problem festgestellt, ich weiß nicht, was ich tun soll. Autocomplete scheint nicht zu funktionieren. Getestet habe ich mit einem einfachen Code auf einem Forum gefunden:Warum funktioniert Python3s Cmd.Cmd-Autocomplete nicht unter Mac OS?
import cmd
addresses = [
'[email protected]',
'[email protected]',
'[email protected]',
]
class MyCmd(cmd.Cmd):
def do_send(self, line):
pass
def complete_send(self, text, line, start_index, end_index):
if text:
return [
address for address in addresses
if address.startswith(text)
]
else:
return addresses
if __name__ == '__main__':
my_cmd = MyCmd()
my_cmd.cmdloop()
Es ist nicht zu funktionieren scheint, es fügt nur ein Leerzeichen (normal tab). Irgendeine Workaround?
In der Tat funktioniert es auch nicht. Es könnte etwas mit der Tatsache sein, dass ich auf einem Mac bin? – Blaxou