From ecd2601d55e2e7e31bcb6ac2ec85f55e1fca6714 2013-04-23 13:14:38
From: Jussi Sainio <jussi.sainio@iki.fi>
Date: 2013-04-23 13:14:38
Subject: [PATCH] Don't crash if README_STARTUP is missing

On Windows inside a py2exe'd environment, README_STARTUP does not
get copied into library.zip. Added a warning and a skip if
the file IPython/config/profile/README_STARTUP is missing.

---

diff --git a/IPython/core/profiledir.py b/IPython/core/profiledir.py
index 03ffaca..ab0bbf5 100644
--- a/IPython/core/profiledir.py
+++ b/IPython/core/profiledir.py
@@ -102,7 +102,11 @@ class ProfileDir(LoggingConfigurable):
             os.mkdir(self.startup_dir)
         readme = os.path.join(self.startup_dir, 'README')
         src = os.path.join(get_ipython_package_dir(), u'config', u'profile', u'README_STARTUP')
-        if not os.path.exists(readme):
+
+        if not os.path.exists(src):
+            self.log.warn("Could not copy README_STARTUP to startup dir. Source file %s does not exist." % src)
+
+        if os.path.exists(src) and not os.path.exists(readme):
             shutil.copy(src, readme)
 
     def _security_dir_changed(self, name, old, new):