ich hoffe, ihr könnt mir hier weiterhelfen.
Ich steuere Über Python Skripte meine Stereo Anlage (via Seriellem Interface).
Nachdem ich mir einen neuen Computer gekauft habe, habe ich aber leider regelmäßig Probleme damit.
Das USB-Serial Interface ist das gleiche geblieben. USB Anschlüsse habe ich mehrere durchprobiert.
Hier mal ein Biespiel für die Skripte:
Code: Alles auswählen
import serial
import sys
import threading
import re
import time
try:
ser = serial.Serial( port="COM7",
baudrate=9600,
bytesize=serial.EIGHTBITS,
parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE,
timeout=20000 )
print ("Serial port is open")
except Exception as e:
print ("error open serial port: " + str(e))
exit()
try:
s = "Test"
print (s)
ser.write(b'\r')
ser.write(b'#1,01,0\r')
s = ser.read(6)
if s == (b'#11,01'):
print ("Was already off.")
ser.write(b'#1,01,1\r')
print (s)
except Exception as e:
print ("error communicating...: " + str(e))
Code: Alles auswählen
Python 3.10.1 (tags/v3.10.1:2cd268a, Dec 6 2021, 19:10:37) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
= RESTART: C:\Program Files (x86)\Corsair\CORSAIR iCUE Software\Macros\Python\Power_Toggel.pyw
error open serial port: could not open port 'COM7': PermissionError(13, 'Zugriff verweigert', None, 5)
w
Jetzt habe ich 3.10 und 3.5.
Ein Versuch mit den alten Versionen ist aber erfolglos geblieben.
Im Moment leuft es nur so in 10% der Fälle.
Wenn es nicht funktioniert hilft nur PC Neustart.
Kein Anderes Programm nutzt (bewusst) dieses Interface.
Neustart des Interfaces über die Systemsteuerung hilft nur ganz selten.
Komplette Neuinstallation der Treiber hat leider auch nichts gebracht.
Ich hoffe ihr könnt mir helfen...
Grüße,
Felix