summaryrefslogtreecommitdiff
path: root/boto/compat.py
diff options
context:
space:
mode:
authorDaniel G. Taylor <danielgtaylor@gmail.com>2014-05-29 15:41:32 -0700
committerDaniel G. Taylor <danielgtaylor@gmail.com>2014-05-29 15:41:32 -0700
commit2414892e11bba5e0bd8afd7ac5169fc44e9014cb (patch)
treedaf8bea5627726636749ee1b92f4b5a562123e5e /boto/compat.py
parentb28e7fc866cb6138fd81e154631877fcecfb1ac7 (diff)
parent373492b77bc1f831a2b7fdbe94fa6fd706342d0e (diff)
downloadboto-2.29.0.tar.gz
Merge branch 'release-2.29.0'2.29.0
Diffstat (limited to 'boto/compat.py')
-rw-r--r--boto/compat.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/boto/compat.py b/boto/compat.py
index 44fbc3b3..a13f58b4 100644
--- a/boto/compat.py
+++ b/boto/compat.py
@@ -19,6 +19,8 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
#
+import os
+
# This allows boto modules to say "from boto.compat import json". This is
# preferred so that all modules don't have to repeat this idiom.
@@ -26,3 +28,14 @@ try:
import simplejson as json
except ImportError:
import json
+
+
+# If running in Google App Engine there is no "user" and
+# os.path.expanduser() will fail. Attempt to detect this case and use a
+# no-op expanduser function in this case.
+try:
+ os.path.expanduser('~')
+ expanduser = os.path.expanduser
+except (AttributeError, ImportError):
+ # This is probably running on App Engine.
+ expanduser = (lambda x: x)