Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix _getTempDir for Windows

  • Loading branch information...
commit 118860ee19fd43ff15b8dcd18f20b2cee245c824 1 parent 438d82c
@dbr authored
Showing with 13 additions and 3 deletions.
  1. +13 −3 tvdb_api.py
View
16 tvdb_api.py
@@ -17,9 +17,11 @@
__author__ = "dbr/Ben"
__version__ = "1.8"
-import os, time
+import os
+import time
import urllib
import urllib2
+import getpass
import StringIO
import tempfile
import warnings
@@ -494,9 +496,17 @@ def __init__(self,
#end __init__
def _getTempDir(self):
- """Returns the [system temp dir]/tvdb_api
+ """Returns the [system temp dir]/tvdb_api-u501 (or
+ tvdb_api-myuser)
"""
- return os.path.join(tempfile.gettempdir(), "tvdb_api-u%s" % (os.getuid()))
+ if hasattr(os, 'getuid'):
+ uid = "u%d" % (os.getuid())
+ else:
+ # For Windows
+ import getpass
+ uid = getpass.getpass()
+
+ return os.path.join(tempfile.gettempdir(), "tvdb_api-%s" % (uid))
def _loadUrl(self, url, recache = False, language=None):
global lastTimeout
Please sign in to comment.
Something went wrong with that request. Please try again.