Python Forum
File system navigation. Changing directory
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
File system navigation. Changing directory
#2
I run Linux natively, I ran your code via python2 game.py and discovered that your error is on line 17. On Linux there is no such thing as "d:\test\sub_1" even if I were to create that file/folder structure. We dont have drive letters, and our path names are delimited by "/" forwards slash. if you change it to os.chdir("/") it seems to work, when I pressed Y it would cycle through the folders/files, when it got to a folder I used B to get into it. Once I did this, I was nolonger able to list my files however so your code prob has a bug that I don't see.

Here is how our filesystem works:

1) There are no drive letters
2) The various hard disks installed under the system are mounted usualy to /mnt/something
3) We dont use backslash
4) / on Linux is simular to C:/ on windows
Reply


Messages In This Thread
RE: File system navigation. Changing directory - by knackwurstbagel - Mar-16-2018, 07:49 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  FileNotFoundError: [WinError 2] The system cannot find the file specified NewBiee 2 1,733 Jul-31-2023, 11:42 AM
Last Post: deanhystad
  Using pyinstaller with .ui GUI files - No such file or directory error diver999 3 3,832 Jun-27-2023, 01:17 PM
Last Post: diver999
  Extract file only (without a directory it is in) from ZIPIP tester_V 1 1,124 Jan-23-2023, 04:56 AM
Last Post: deanhystad
Thumbs Up Need to compare the Excel file name with a directory text file. veeran1991 1 1,213 Dec-15-2022, 04:32 PM
Last Post: Larz60+
  no such file or directory in SFTP saisankalpj 2 1,688 Nov-25-2022, 11:07 AM
Last Post: DeaD_EyE
Photo Making Zip file of a file and Directory Nasir 2 1,096 Oct-07-2022, 02:01 PM
Last Post: Nasir
  Changing the initial worksheet name in an MS Excel file azizrasul 3 1,050 Oct-02-2022, 07:56 PM
Last Post: azizrasul
  Changing file location azizrasul 6 1,422 Sep-28-2022, 01:01 AM
Last Post: azizrasul
  Failed to execute child process (No such file or directory) uriel 1 1,725 Sep-15-2022, 03:48 PM
Last Post: Gribouillis
  Need Help: FileNotFoundError:[Errno 2] No such file or directory python202209 5 2,851 Sep-12-2022, 04:50 AM
Last Post: python202209

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020