-
-
Save nmcspadden/9d93c08106d78409148d32ca91b01a6a to your computer and use it in GitHub Desktop.
Register Tableau
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
"""Register Tableau with a pre-filled Registration plist.""" | |
import os | |
import sys | |
import subprocess | |
# You'll need to get this into your path if you don't have it | |
import FoundationPlist | |
reg_plist = os.path.join( | |
os.path.expanduser('~'), 'Library', 'Application Support', | |
'com.tableau.Registration.plist' | |
) | |
if ( | |
not os.path.exists(reg_plist) or | |
not os.path.exists('/Applications/Tableau9.3') | |
): | |
print "DOES NOT EXIST: %s" % reg_plist | |
sys.exit(1) | |
thePlist = FoundationPlist.readPlist(reg_plist) | |
keys = thePlist.keys() | |
if len(keys) > 12: | |
# Something other than the Data keys is present, so it's registered | |
sys.exit(0) | |
cmd = [ | |
'/Applications/Tableau9.3/Tableau.app/Contents/MacOS/Tableau', | |
'-register' | |
] | |
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) | |
(out, err) = proc.communicate() | |
print out | |
if err: | |
print err |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment