diff --git a/SimPEG/Examples/__init__.py b/SimPEG/Examples/__init__.py index 894d6ea0..7ef15451 100644 --- a/SimPEG/Examples/__init__.py +++ b/SimPEG/Examples/__init__.py @@ -29,16 +29,17 @@ if __name__ == '__main__': from SimPEG import Examples # Create the examples dir in the docs folder. - docExamplesDir = os.path.sep.join(os.path.realpath(__file__).split(os.path.sep)[:-3] + ['docs', 'examples']) + fName = os.path.realpath(__file__) + docExamplesDir = os.path.sep.join(fName.split(os.path.sep)[:-3] + ['docs', 'examples']) shutil.rmtree(docExamplesDir) os.makedirs(docExamplesDir) # Get all the python examples in this folder - thispath = os.path.sep.join(__file__.split(os.path.sep)[:-1]) + thispath = os.path.sep.join(fName.split(os.path.sep)[:-1]) exfiles = [f[:-3] for f in os.listdir(thispath) if os.path.isfile(os.path.join(thispath, f)) and f.endswith('.py') and not f.startswith('_')] # Add the imports to the top in the AUTOIMPORTS section - f = file(__file__, 'r') + f = file(fName, 'r') inimports = False out = '' for line in f: @@ -53,7 +54,7 @@ if __name__ == '__main__': out += '\n##### AUTOIMPORTS #####\n' f.close() - f = file(__file__, 'w') + f = file(fName, 'w') f.write(out) f.close()