]> jfr.im git - z_archive/twitter.git/commitdiff
Fix Issue #60 can't write config file on Windows
authorAnmar Mansur <redacted>
Fri, 11 Jan 2013 17:50:38 +0000 (10:50 -0700)
committerAnmar Mansur <redacted>
Fri, 11 Jan 2013 17:50:38 +0000 (10:50 -0700)
Windows doesn't have a HOME environment variable. The config file ends up being written to the root of system drive, hence the need for admin rights. Windows does however define a USERPROFILE environment variable that points correctly to the logged in user's profile home folder where most Python programs store their settings. Tested on Windows 7 x64 and Windows 8 x64.

twitter/ircbot.py

index 463136fa7c0952870e9f891b1ba93ddb05884943..b41eefd33f9dba6b24d6d2fae50a88382a114741 100644 (file)
@@ -87,7 +87,7 @@ except ImportError:
         "This module requires python irclib available from "
         + "https://github.com/sixohsix/python-irclib/zipball/python-irclib3-0.4.8")
 
-OAUTH_FILE = os.environ.get('HOME', '') + os.sep + '.twitterbot_oauth'
+OAUTH_FILE = os.environ.get('HOME', os.environ.get('USERPROFILE', '')) + os.sep + '.twitterbot_oauth'
 
 def debug(msg):
     # uncomment this for debug text stuff