Skip to content

Commit

Permalink
Fix _getTempDir for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
dbr committed Oct 2, 2012
1 parent 438d82c commit 118860e
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions tvdb_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 118860e

Please sign in to comment.