Python – die besten Beiträge

Python Error: [WinError 6] Das Handle ist ungültig fixen?

Moin seit kurzem funktioniert

sys.exit()

bei mir in Python nicht mehr.

Das Programm schließt sich aber es erscheint eine Fehlermeldung

FELHER:

Cancelling an overlapped future failed

future: <_OverlappedFuture pending overlapped=<pending, 0x2ea7a20> cb=[BaseProactorEventLoop._loop_self_reading()]>

Traceback (most recent call last):

 File "C:\Users\Anwender\AppData\Local\Programs\Python\Python38-32\lib\asyncio\runners.py", line 43, in run

  return loop.run_until_complete(main)

 File "C:\Users\Anwender\AppData\Local\Programs\Python\Python38-32\lib\asyncio\base_events.py", line 603, in run_until_complete

  self.run_forever()

 File "C:\Users\Anwender\AppData\Local\Programs\Python\Python38-32\lib\asyncio\windows_events.py", line 316, in run_forever

  super().run_forever()

 File "C:\Users\Anwender\AppData\Local\Programs\Python\Python38-32\lib\asyncio\base_events.py", line 570, in run_forever

  self._run_once()

 File "C:\Users\Anwender\AppData\Local\Programs\Python\Python38-32\lib\asyncio\base_events.py", line 1859, in _run_once

  handle._run()

 File "C:\Users\Anwender\AppData\Local\Programs\Python\Python38-32\lib\asyncio\events.py", line 81, in _run

  self._context.run(self._callback, *self._args)

 File "D:/Ruben/Projects/Python/Testing/main.py", line 15, in auswahlfenster

  await loginchecker()

 File "D:/Ruben/Projects/Python/Testing/main.py", line 36, in loginchecker

  raise SystemExit

SystemExit

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

 File "C:\Users\Anwender\AppData\Local\Programs\Python\Python38-32\lib\asyncio\windows_events.py", line 66, in _cancel_overlapped

  self._ov.cancel()

OSError: [WinError 6] Das Handle ist ungültig

DEF LOGINCHECKER:

Bild zum Beitrag
Computer, programmieren, Informatik, Python

Python | was ist hier falsch?

def open_file():

   my_text.delete("1.0", END)

   #get filename
   text_file = filedialog.askopenfilename(initialdir="C:/", title="Open File", filetyßes=(("Text Files", "*.txt")))

Ich habe ein Tutorial auf YouTube nachgemacht um einen Text Editor zu erstellen.

Ich bin momentan bei der Funktion um Datein zu öffnen.

Also funktioniert bisher, außer es kommt beim öffnen immer ein Fehler der aber laut dem Py Terminal diese Zeile ist

text_file = filedialog.askopenfilename(initialdir="C:/", title="Open File", filetypes=(("Text Files", "*.txt")))

Kann mir jemand sagen was an dieser Zeile falsch ist?

Hier mal den Console Log

Exception in Tkinter callback
Traceback (most recent call last):

File "C:\xyz\AppData\Local\Programs\Python\Python37\lib\tkinter\__init__.py", line 1705, in __call__
    return self.func(*args)

  File "C:\xyz\editor.py", line 16, in open_file
    text_file = filedialog.askopenfilename(initialdir="C:/Benutzer", title="Open File", filetypes=(("Text Files", "*.txt")))

)))
  File "C:\xyz\AppData\Local\Programs\Python\Python37\lib\tkinter\filedialog.py", line 375, in askopenfilename
    return Open(**options).show()
  File "C:\xyz\AppData\Local\Programs\Python\Python37\lib\tkinter\commondialog.py", line 43, in show
    s = w.tk.call(self.command, *w._options(self.options))
_tkinter.TclError: bad file type "*.txt", should be "typeName {extension ?extensions ...?} ?{macType ?macTypes ...?}?"


Computer, programmieren, Informatik, Python

Meistgelesene Beiträge zum Thema Python