[Python] How to debug the "FileNotFoundError: [WinError 2] The system cannot find the file...

Discussão em 'Python' iniciado por Stack, Fevereiro 19, 2025.

  1. Stack

    Stack Membro Participativo

    Before running the program,I had to run this code in the terminal as shown below:

    (venv) C:\Users\user pc\PycharmProjects\testProj>pip install -U pip --user
    Requirement already up-to-date: pip in c:\users\user pc\pycharmprojects\testproj\venv\lib\site-packages (19.0.3)

    (venv) C:\Users\user pc\PycharmProjects\testProj>pip install psycopg2 --user
    Requirement already satisfied: psycopg2 in c:\users\user pc\pycharmprojects\testproj\venv\lib\site-packages (2.7.7)


    So, the pip got installed. Only after running this, I have to run my program, in which the following error is occuring:

    "C:\Users\user pc\PycharmProjects\testProj\venv\Scripts\python.exe" "C:/Users/user pc/PycharmProjects/testProj/auto.py"
    The unique id is 1
    Traceback (most recent call last):
    File "C:/Users/user pc/PycharmProjects/testProj/auto.py", line 381, in <module>
    p = subprocess.Popen(["dscsm047.exe"], stdout=subprocess.PIPE, stdin=subprocess.PIPE)
    File "C:\Users\user pc\AppData\Local\Programs\Python\Python37-32\lib\subprocess.py", line 775, in __init__
    restore_signals, start_new_session)
    File "C:\Users\user pc\AppData\Local\Programs\Python\Python37-32\lib\subprocess.py", line 1178, in _execute_child
    startupinfo)
    FileNotFoundError: [WinError 2] The system cannot find the file specified

    Process finished with exit code 1


    Could you please be more clear and specific about the process to debug this error as I am very new to this programming field.

    Continue reading...

Compartilhe esta Página