Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions create_dir_if_not_there.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
import os # Import the OS module
try:
home = os.path.expanduser("~") # Set the variable home by expanding the users set home directory
print home # Print the location
print(home) # Print the location

if not os.path.exists(home + '/testdir'):
os.makedirs(home + '/testdir') # If not create the directory, inside their home directory
except Exception, e:
print e
if not os.path.exists(os.path.join(home, 'testdir')): # os.path.jon() for making a full path safely
os.makedirs(os.path.join(home, 'testdir')) # If not create the directory, inside their home directory
except Exception as e:
print(e)