Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
mkdir() help
#6
Put a print statement around os.getcwd()

def make_file():
   print('Current working directory', os.getcwd())
   os.chdir('export')
   os.mkdir(str(name.get())) 
Execute the program and look in which current working directory your program is running.
Look if you can reach from this path 'export'. I think your cwd is at a different path
as the directory 'export'.

By the way, os.mkdir makes a directory, not a file.
If you want to read/write file, use open(filepath).

After you've understood the old school os.path and the difference between relative and absolute paths, you should take a look into the pathlib module.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply


Messages In This Thread
mkdir() help - by SteampunkMaverick12 - Feb-17-2018, 11:50 AM
RE: mkdir() help - by Gribouillis - Feb-17-2018, 01:28 PM
RE: mkdir() help - by SteampunkMaverick12 - Feb-17-2018, 03:53 PM
RE: mkdir() help - by Gribouillis - Feb-17-2018, 05:30 PM
RE: mkdir() help - by SteampunkMaverick12 - Feb-17-2018, 06:02 PM
RE: mkdir() help - by DeaD_EyE - Feb-17-2018, 06:02 PM
RE: mkdir() help - by SteampunkMaverick12 - Feb-18-2018, 03:20 PM
RE: mkdir() help - by Gribouillis - Feb-17-2018, 06:06 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  directory not being created after os.mkdir() CAD79 3 577 Mar-16-2024, 04:00 PM
Last Post: deanhystad
  OSERROR When mkdir Oshadha 4 1,956 Jun-29-2022, 08:50 AM
Last Post: DeaD_EyE
  Python Paramiko mkdir command overwriting existing folder. How can i stop that? therenaydin 1 3,369 Aug-02-2020, 11:13 PM
Last Post: therenaydin

Forum Jump:

User Panel Messages

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