Troubleshooting FileNotFoundError: [Errno 2] No such file or directory: errors in Python

Поділитися
Вставка
  • Опубліковано 1 січ 2025

КОМЕНТАРІ • 11

  • @josefelamin9792
    @josefelamin9792 Місяць тому +1

    I know this comment is a year old but this video was great help and solved the issue i was dealing with for hours. Thank youuu!

  • @blacklotus432
    @blacklotus432 9 місяців тому +1

    So i created a batch file that opens a python file. The only way it seems to be working is if I save the file in the working directory but i don't want to have it saved there. How could i be able to do this without saving it in the working directory of python.

    • @blacklotus432
      @blacklotus432 9 місяців тому

      and yes i used the absolute path and still get Errno 2 no such file or directory

    • @DesignCodeDebugRepeat
      @DesignCodeDebugRepeat  9 місяців тому

      I'm not sure. This video is based on errors I see my students making, and I haven't had them do that, so I can't give you a set of potential errors from experience. I just wrote one and it can open a Python file in the same directory, via a relative path, or via an absolute path. Off the top of my head, I think potential errors are (I'm not implying you haven't checked these things -- just suggestions) that you have something wrong in your path (possibly whitespace characters in the path?) or that you don't have your environment variables set?

    • @blacklotus432
      @blacklotus432 9 місяців тому +1

      @@DesignCodeDebugRepeat hmm it sounds like I might not have my environment variables set. Thanks for the help!

    • @DesignCodeDebugRepeat
      @DesignCodeDebugRepeat  9 місяців тому +1

      @@blacklotus432That's possible! Good luck to you.

  • @taichifukubayashi-ness2968
    @taichifukubayashi-ness2968 20 днів тому +1

    thanks noticed that I had a space in the file name LOL

    • @DesignCodeDebugRepeat
      @DesignCodeDebugRepeat  20 днів тому

      Oh, good catch! In a graphical user interface you don't have this problem, because you can use a file picker dialog box. 😁

  • @blitzcreegzero8807
    @blitzcreegzero8807 7 місяців тому +1

    wish I could like this as many times as ive used it haha

    • @DesignCodeDebugRepeat
      @DesignCodeDebugRepeat  7 місяців тому

      Well, I'm so glad!! 😊 These are the errors I see my students making most often -- I guess they're pretty common! Thank you for commenting. I like to know when people find my content useful! 😁