Home‎ > ‎

IDLE Working Directory

posted Aug 2, 2012, 12:16 PM by Sophie Engle

If you want to be able to import your files easily in IDLE, you need to make sure the working directory for IDLE is set to the folder with all of your code. For example, my in-class code is located at the directory /Users/sjengle/Desktop/Code, so to change the working directory of IDLE I need to run the following two commands:

import os

Then, I can import my files with a simple import statement. If I have multiple folders I want to use, I would instead use sys.path.append() as follows:

import sys

If you need help with this setup, just let me know after class.