0

I have installed the Python3 package in my Applications(Applications folder at the root level) folder and start IDLE from there itself. However, when I execute os.getcwd() it prints Users/my_user_name/Documents. Is it the correct output? Why is my current working directory Documents?

  • Specs: MacOS Catalina 2.3 GHz Dual-Core Intel Core i5.
iCantC
  • 2,852
  • 1
  • 19
  • 34
  • 1
    Does this answer your question? [What's the working directory when using IDLE?](https://stackoverflow.com/questions/15821121/whats-the-working-directory-when-using-idle) – dspencer Mar 15 '20 at 05:04
  • Sorry, but as I mentioned I have installed Python module in the Applications folder, but it still returns `Documents` as my current working directory. – iCantC Mar 15 '20 at 05:15
  • IDLE is configured with a working directory, not connected to the installation directory of the program. `Documents` is the default as it would be the most standard place within which to have your program files. – dspencer Mar 15 '20 at 05:19
  • so `Documents` is the by-default working directory when using IDLE? – iCantC Mar 15 '20 at 05:46
  • 3
    Your understanding of current working directory is faulty. It has nothing to do with where Python is installed. It is at least momentarily the current directory you’re in when you launch Python from a command line, however the program you launch may have its own logic for where to set the CWD. Idle is one such program — it changes the CWD to one specified in its config. The easiest thing you can do is (a) change it’s config, or (b) run `import os; os.chdir(whatever)` after starting Idle. – Chris Johnson Mar 15 '20 at 05:47
  • One last question, when I run `os.makedirs()` will the new directory be created in my current working directory? – iCantC Mar 15 '20 at 05:52

0 Answers0