0

I'm attempting check if a directory exists by running

self.path = '~/foo'
    if not os.path.exists(self.path):
        os.makedirs(self.path)

On an Ubuntu virtual machine. Although this directory does not exist, it does not make the directory. In fact using a print statement right above the makedirs command. Any idea what it could be?

user2171584
  • 1,193
  • 3
  • 8
  • 5

1 Answers1

2

You probably want to os.path.expanduser on the path first...

mgilson
  • 283,004
  • 58
  • 591
  • 667