import os
import shutil
from gi.repository import Gio

shutil.rmtree('./intermediate', ignore_errors=True)

dirs = [Gio.File.new_for_path('./intermediate/dir1'),
    Gio.File.new_for_path('./intermediate/dir2')]

process = 0 if os.fork() == 0 else 1

try:
    dirs[process].make_directory_with_parents(None)
except Exception as e:
    print 'process {0} says: ({1.code}) {1.message}'.format(process, e)
print 'process {0} says: requested directory'.format(process),
print 'exists' if dirs[process].query_exists(None) else 'does not exist'
