Interrupcion de script

Este codigo o scritp lo ejecutaba sin problema en visual studio y pycharm,consiste en dar informacion de los puertos USB los que se conectan y desconectan en tiempo real mientras estan en ejecucion pero de repente dejaron de ejecutarse al menos que le des correr en la consola cuando se corria solo hasta que le dabas stop ya vi vario foros y no hay una respuesta que me diga que fue lo que paso…..(comparto el codigo o script)

import serial.tools.list_ports



puertos = serial.tools.list_ports.comports()



if not puertos:
    print("No se encontraron puertos seriales conectados.")
else:
    print("Dispositivos USB/seriales encontrados:")
    for puerto in puertos:
        print(f"  - Dispositivo: {puerto.device}")
        print(f"    Descripción: {puerto.description}")
        print(f"    VID: {puerto.vid}, PID: {puerto.pid}")
        print(f"    Hijo: {puerto.hwid}\n")
        input()

0
1 comment

Hi Vanebra4141 

 

May I ask which PyCharm version/Python version you are using ? 

 

If I understand correctly you are unable to run this script from PyCharm but no issue from terminal or other IDEs

Will you please provide me a screenshot of the error you are getting ? 

 

On my side using PyCharm v2025.2.1.1 (but also older versions) I do not have a problem to run the script after installing the pyserial package:

you can install this with the quick fix note from PyCharm or from the terminal in your venv run pip install pyserial

 

After this step I am able to execute the script from PyCharm and have the same output as from command line.

 

 

Please let me know if you are also able to make this work as expected after checking the above or otherwise please send me a screenshot showing the issue on your end.

 

Kind regards,

 

 

 

0

Please sign in to leave a comment.