0

I have to download McAfee virus definition update file and then execute it. If I download it directrly from site using Windows download/save ... it works fine. In my case I do it using python script from http://download.nai.com/products/licensed/superdat/english/intel/ When I try to execute the file downloaded using script it failed with this error:

>7615xdat.exe
This version of N:\DeleteMe\deleteMePlease\7615xdat.exe is not compatible with the version of
Windows you're running. Check your computer's system information to see whether you need a x86
 (32-bit) or x64 (64-bit) version of the program, and then contact the software publisher.

I noticed that while both files have the same name they are different in size ( the one downloaded using script is slightly bigger), they have also different icon in windows explorer. I assume that python script does not make 'exact' copy of the file from web which result into the error. Any idea how to fix it? I will attach the script I am using:

import urllib
import lxml.html
import os
import shutil

# index page
pattern_files_url = "http://download.nai.com/products/licensed/superdat/english/intel"
# relative url references based here
pattern_files_base = '/'.join(pattern_files_url.split('/')[:-1])

# scrape the index page for latest file list
doc = lxml.html.parse(pattern_files_url)
pattern_files = [ref for ref in doc.xpath("//a/@href") if ref.endswith('xdat.exe')]
if pattern_files:
    pattern_files.sort()
    newest = pattern_files[-1]
    local_name = newest.split('/')[-1]
    # grab it if we don't already have it
    if not os.path.exists(local_name):
        url = pattern_files_base + '/' + newest
        remote = urllib.urlopen(url)
        with open(local_name, 'w') as local:
            shutil.copyfileobj(remote, local, length=65536)
Anshu Prateek
  • 3,011
  • 1
  • 18
  • 33
susja
  • 311
  • 3
  • 12
  • 33

0 Answers0