AWS Thinkbox Discussion Forums

uninstall.py compile fails

Hi Guys

I’m having some trouble compiling the uninstall wrapper using cx_freeze.

I created the uninstall.py file, adding the indenting in manually as this didn’t come across with a copy & paste. This might be the issue.

The error I get when trying to compile is shown in the attachment, as is the uninstall.py file I’m using.

Also note that on page 133, the command line instructions run off the edge of the page, so I can’t tell what was expected to follow -target. The cx_freeze docs appear to suggest that this should be a double dash before ‘target’?

Regards

Fergus


uninstall.zip (587 Bytes)

Hey Fergus,

Sorry, at first I was a bit confused by cx_freeze and uninstall.py, then I realized you were referring to our docs that show how to create an uninstall wrapper…

You are definitely right that the target-dir should be a double-dash, single dash does not work. I’ll be sure to update that.

As for the script itself, here’s a version that has been modified to fix the syntax errors in your copy:

[code]import sys
import subprocess
import string
import re
from time import sleep

def uninstall_running():
process_list_raw = subprocess.check_output([ “C:/Windows/System32/tasklist.exe”, “/FO:csv”] )

re_uninstall = re.compile("^_uninstall[0-9]*$")

for process_line in string.split(process_list_raw, "\n"):
	process_name = string.split(string.replace(process_line, "\"", ""), ",")[0]
	if re_uninstall.match(process_name):
		return 1
return 0

num_args = len(sys.argv)

if num_args <= 1:
print “Error: No command was entered”
exit(1)

args = []
args.append(sys.argv[1])

if num_args >= 2:
for i in range(2, num_args):
args.append(str(sys.argv[i]))
try:
p = subprocess.Popen(args)
p.wait()
except WindowsError:
print “Error: Executable does not exist”

while uninstall_running():
sleep(10)
[/code]

As for the cut-offs in our PDF documentation, I would definitely recommend using the HTML versions of our docs, since those should not have that issue, and would allow for easier copy-pasting.

Cheers,
Jon

Privacy | Site terms | Cookie preferences